Excel Formulas to Sum if Cells Contain Either X or Y!!
Tags: excelformula, excelformulas
Published: 2020-11-30 11:53:32

---
title: Excel Formulas to Sum if Cells Contain Either X or Y!!
published: true
date: 2020-11-30 09:07:06 UTC
tags: ExcelFormula,Excelformulas
canonical_url: https://geekexcel.com/excel-formulas-to-sum-if-cells-contain-either-x-or-y/
---

Here, we will explain the **formulas to sum the values in the cells that contain either one text string or another (i.e. cells contain either X or Y)** in Excel Office 365. Let’s get into this article!! Get an official version of ** MS Excel**  from the following link: [https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)

[![Formulas to sum if cells contain either X or Y](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/11/Formulas-to-sum-if-cells-contain-either-X-or-Y.png)](https://geekexcel.com/excel-formulas-to-sum-if-cells-contain-either-x-or-y/formulas-to-sum-if-cells-contain-either-x-or-y/#main)<figcaption id="caption-attachment-18244">Formulas to sum if cells contain either X or Y</figcaption>
## General Formula:

- Use the below formula to sum the values in the cells that contain either one or another text string.

**=[SUMPRODUCT](https://geekexcel.com/how-to-use-excel-sumproduct-function-in-office-365/)(–(([ISNUMBER](https://geekexcel.com/how-to-use-isnumber-function-in-microsoft-excel-365/)([SEARCH](https://geekexcel.com/use-search-function-in-microsoft-excel-2013-simple-methods/)(“X”,range1)) + ISNUMBER(SEARCH(“Y”,range1)))>0),range2)**

## Syntax Explanations:

- **SUMPRODUCT** – This function helps to multiply the corresponding arrays or ranges and returns the sum of the products. Read more on the **[SUMPRODUCT Function](https://geekexcel.com/how-to-use-excel-sumproduct-function-in-office-365/)**.
- **ISNUMBER** – In Excel, the [**ISNUMBER Function**](https://geekexcel.com/how-to-use-isnumber-function-in-microsoft-excel-365/) returns TRUE when a cell contains a number, and FALSE if there will not be a number.
- **SEARCH** – It will help to locate the character between ** two text string** and returns to the ** number**  of the ** starting position**  of the ** first text string**  from the **first character of the second text string**. Read more on the [**SEARCH Function**](https://geekexcel.com/use-search-function-in-microsoft-excel-2013-simple-methods/).
- **Plus operator (+)** – This symbol is used to add the values.
- **Comma symbol (,)** – It is a separator which helps to separate a list of values.
- **Parenthesis ()** – The main purpose of this symbol is to group the elements.
- **Minus Operator (-)** – This symbol will help to subtract any two values.
- **Text (X or Y)** – It is the criteria that are used to sum the cells.
- **Range** – It represents the input values given in a worksheet.

## Example:

- Let’s consider the below image to sum the values in the cells that contain either one text string or another.
- First, we will give the input values in **Column B** and **Column C**.
- Then, enter the given formula in the formula bar section.
- Finally, we will get the result in **Cell F3**.

![Example](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/11/Example-74.png)<figcaption id="caption-attachment-18243">Example</figcaption>

## Closure:

In this tutorial, we guided you to learn the simple **formula used to sum the cells that contain either X or Y in Excel Office 365**. Hope you like this article. Don’t forget to share your worthwhile **feedback** in the below section. Thank you so much for Reading!! Keep learning on **[Geek Excel](https://geekexcel.com/)!! **and [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

### Read Also:

- **[Excel Formulas to Count Cells that do not contain Errors!!](https://geekexcel.com/excel-formulas-to-count-cells-that-do-not-contain-errors/)**
- **[Formulas to Sum the Values by Group in Excel Office 365!!](https://geekexcel.com/formulas-to-sum-the-values-by-group-in-excel-office-365/)**
- [**Excel Formulas to Extract the Nth Word from a Text String!!**](https://geekexcel.com/excel-formulas-to-extract-the-nth-word-from-a-text-string/)