How to Sum If Cell Contains a Text in Excel (6 Suitable Examples)

Sometimes we need to sum up numerical values based on the corresponding cells that contain text within them. So, it is quite a common scenario while analyzing data from a data table in Excel. So, in this article, we are going to teach you six easy ways, to sum up, numerical values in Excel if their corresponding cell contains specific text.


Download Practice Workbook

You are recommended to download the Excel file and practice along with it.


6 Examples to Sum If Cell Contains Specific Text in Excel

We will be using a sample product price list as a dataset to demonstrate all the methods throughout the article. Let’s have a sneak peek of it:

sum if cell contains text dataset

So, without having any further discussion, let’s dive straight into all the methods one by one.


1. Using SUMIF Function to Sum Based on Text Criteria

In the spreadsheet, we have a product price list with categories. So, in this section, we will try to calculate the total price of the products under the Wafer category using the SUMIF function. Here are the steps to follow:

🔗 Steps:

❶ First of all, select cell C15 ▶ to store the result of the SUMIF function.

❷ Then, type the formula within the cell.

=SUMIF(B5:B12,"*Wafer*", E5:E12)

❸ After that press the ENTER button.

Sum If Cell Contains Specific Text in Excel Using SUMIF Function

␥ Formula Breakdown:

📌 Syntax: SUMIF(range, criteria, [sum_range])

  • Firstly, B5:B12 ▶ the range where the SUMIF function will look for the word “Wafer”.
  • Secondly, “*Wafer*” ▶ the search keyword.
  • Thirdly, E5: E12 ▶ the sum range.
  • Finally, =SUMIF(B5:B12,”*Wafer*”, E5:E12) ▶ returns the total price of the products under the “Wafer” category.

Read More: If Cell Contains Specific Text Then Add 1 in Excel (5 Examples)


2. Using SUMIFS Function in Excel to Add Up Data That Contain a Specific Text

Here, we will use the SUMIFS function to compute the total price of the products under the Wafer category.

🔗 Steps:

❶ First of all, select cell C15 ▶ to store the result of the SUMIFS function.

❷ Then, type the formula within the cell.

=SUMIFS(E5:E12,B5:B12,"*Wafer*")

❸ After that press the ENTER button.

Add up If Cell Contains Text Using SUMIFS Function in Excel

␥ Formula Breakdown:

📌 Syntax: SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)

  • At first, E5: E12 ▶ the sum range.
  • Then, B5:B12 ▶ the range where the SUMIFS function will look for the word “Wafer”.
  • Furthermore, “*Wafer*” ▶ the search keyword.
  • At last, =SUMIFS(E5:E12, B5:B12,”*Wafer*”) ▶ returns the total price of the products under the “Wafer” category.

Read More: How to Use VLOOKUP If Cell Contains a Word within Text in Excel


3. Sum If Cell Contains Text in Another Cell in Excel Using SUMIF Function

For our convenience and clarity, we may put search keywords in a separate cell. So, to handle those situations, you will learn the ways to perform the sum operation if the cell contains the text by the steps below.

🔗 Steps:

❶ First of all, select cell C15 ▶ to store the result of the SUMIF function.

❷ Then, type the formula within the cell.

=SUMIF(B5:B12,"*"&C14&"*",E5:E12)

❸ After that press the ENTER button.

Sum If Cell Contains Text in Another Cell in Excel Using SUMIF Function

␥ Formula Breakdown:

📌 Syntax: SUMIF(range, criteria, [sum_range])

  • In the beginning, B5:B12 ▶ the range where the SUMIF function will look for the word “Wafer”.
  • Again, “*”&C14&”*” ▶ refers to the address of the cell that contains the search keyword “Wafer”.
  • E5: E12 ▶ the sum range.
  • In the end, =SUMIF(B5:B12,”*”&C14&”*”,E5:E12) ▶ returns the total price of the products under the “Wafer” category.

Read More: If Cell Contains Text Then Copy to Another Sheet in Excel


Similar Readings


4. Add Up If Cell Contains Text in Another Cell Using SUMIFS Function

You can use the SUMIFS function to add up cells that contain text but in another cell. Follow the steps below to learn:

🔗 Steps:

❶ First of all, select cell C15 ▶ to store the result of the SUMIF function.

❷  Type the formula

=SUMIFS(E5:E12,B5:B12,"*"&C14&"*")
within the cell.

❸ After that press the ENTER button.

Add up If Cell Contains Text in Another Cell Using SUMIFS Function in Excel

␥ Formula Breakdown:

📌 Syntax: SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)

  • E5: E12 ▶ the sum range.
  • B5:B12 ▶ the range where the SUMIFS function will look for the word “Wafer”.
  • “”*”&C14&”*”” ▶ refers to the address of the cell that contains the search keyword “Wafer”.
  • =SUMIFS(E5:E12,B5:B12,”*”&C14&”*”) ▶ returns the total price of the products under the “Wafer” category.

Read More: Sum Cells in Excel: Continuous, Random, With Criteria, etc.


5. Calculate the Total Price Based on Multiple Text Type AND Criteria

Criteria can be applicable for a single column as well as for multiple columns. In this section, we will learn formulas for both cases.

5.1 Within a Single Column

This time we will try to calculate the total price of the product under the Biscuit and Candies category. Follow the steps:

🔗 Steps:

❶ First of all, select cell C15 ▶ to store the total price.

❷ Then, type the formula

=SUM(SUMIF(B5:B12, {"Biscuit","Candies"},E5:E12))
within the cell.

❸ Finally press the ENTER button.

␥ Formula Breakdown:

📌 Syntax of the SUM function: SUM(number1,[number2],…)

📌 Syntax of the SUMIF function: SUMIF(range, criteria, [sum_range])

  • At first, B5:B12 ▶ the range where the SUMIF function will look for the word “Wafer”.
  • Then, “Biscuit”,”Candies” ▶ the search keywords.
  • Again, E5: E12 ▶ the sum range.
  • At last, =SUM(SUMIF(B5:B12, {“Biscuit”,”Candies”},E5:E12)) ▶ returns the total price of the products under the Biscuit and Candies category.

Read More: How to Sum a Column in Excel (6 Methods)


5.2 Within Multiple Columns

Now we will try to calculate the total price of the products under the “Pasta” category and have the word “Ravioli” in their product name. Follow the steps below to see how it works:

🔗 Steps:

❶ First of all, select cell C15 ▶ to store the total price.

❷ Then, type the formula

=SUMIFS(E5:E12,B5:B12,"Pasta",C5:C12,"Ravioli")
within the cell.

❸ After that press the ENTER button.

␥ Formula Breakdown:

📌 Syntax: SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2], …)

  • E5: E12 ▶ the sum range.
  • Then, B5:B12 ▶ the range where the SUMIFS function will look for the word “Pasta”.
  • Next, “Pasta”,”Ravioli” ▶ the search keywords.
  • Again, C5:C12 ▶ the range where the SUMIFS function will look for the word “Ravioli”.
  • At last, =SUMIFS(E5:E12,B5:B12,”Pasta”,C5:C12,”Ravioli”) ▶ returns the total price of the products under the “Pasta” category and have “Ravioli” in the product name.

Read More: How to Sum Columns in Excel (7 Methods)


6. Calculate the Sum Value in Excel If Cell Contains No Text

This time, we will calculate the total price for the products whose categories are missing. Follow the below steps:

🔗 Steps:

❶ First of all, select cell C15 ▶ to store the result of the SUMIF function.

❷ Then, type the formula

=SUMIF(B5:B12, "", E5:E12)
within the cell.

❸ After that press the ENTER button.

␥ Formula Breakdown:

📌 Syntax: SUMIF(range, criteria, [sum_range])

  • First, B5:B12 ▶ the range where the SUMIF function will look for the missing category.
  • Second, “” ▶ specifies blank cell.
  • Third, E5: E12 ▶ the sum range.
  • Finally, =SUMIF(B5:B12, “”, E5:E12) ▶ returns the total price of the products whose categories are missing.

Read More: How to Sum Range of Cells in Row Using Excel VBA (6 Easy Methods)


Things to Remember

  • Be careful about the syntax of the functions.
  • Insert the data ranges carefully into the formulas.

Conclusion

In conclusion, we have illustrated six different methods, to sum up, numerical values if the cell contains text in them. Again, you are recommended to download the practice workbook attached along with this article and practice all the methods with that. And don’t hesitate to ask any questions in the comment section below. We will try to respond to all the relevant queries asap. You can also send us your problem to [email protected].


Related Articles

Mrinmoy Roy

Mrinmoy Roy

Hi! I'm Mrinmoy Roy. I'm an Excel and VBA content developer. I write blogs relating to Microsoft Excel on Exceldemy.com. I've completed my graduation in Electronics and Communication Engineering from Khulna University of Engineering & Technology. I've expertise in Excel functions, formulas, Pivot Table, Power Query, Visual Basic, etc. I write blogs to lessen people's hassles while working on Microsoft Excel.

We will be happy to hear your thoughts

Leave a reply

5 Excel Hacks You Never Knew

Genius tips to help you unlock Excel's hidden features

FREE EMAIL BONUS

ExcelDemy
Logo