ElyxAI
formulas

How to How to Sum If Cell Contains Text in Excel

Excel 2016Excel 2019Excel 365Excel 2021

Learn to sum cells based on text criteria using SUMIF and SUMIFS formulas. This tutorial covers conditional summation when cells contain specific text, partial matches, or multiple text conditions. Master these formulas to automate data analysis and create dynamic reports without manual filtering.

Why This Matters

Summing cells by text criteria is essential for financial analysis, inventory management, and data reporting. This skill saves time by automating conditional calculations that would otherwise require manual sorting.

Prerequisites

  • Basic understanding of Excel cell references and ranges
  • Familiarity with SUM formula syntax
  • Knowledge of logical operators and wildcards

Step-by-Step Instructions

1

Open Your Excel File and Identify Data

Open Excel and locate the data range containing text criteria and values to sum. Note the column with text data and the adjacent column with numeric values you want to sum.

2

Click on the Target Cell for Your Formula

Select an empty cell where you want the result to appear, typically below or beside your data range.

3

Enter the SUMIF Formula with Text Criteria

Type the formula: =SUMIF(range_with_text, 'text_criteria', sum_range). For example: =SUMIF(A2:A10, '*apple*', B2:B10) to sum values where cells contain 'apple'.

4

Use Wildcards for Partial Text Matches

Use asterisks (*) as wildcards: * before and after text matches anywhere in the cell (e.g., '*sales*'), * after matches text at the start (e.g., 'sales*'), * before matches text at the end (e.g., '*sales').

5

Press Enter and Verify Results

Press Enter to execute the formula. Verify the sum is correct by manually checking a few matching cells in your criteria range.

Alternative Methods

SUMIFS for Multiple Text Criteria

Use =SUMIFS(sum_range, criteria_range1, criteria1, criteria_range2, criteria2) to sum based on multiple text conditions simultaneously.

SUMPRODUCT with SEARCH Function

Use =SUMPRODUCT((ISNUMBER(SEARCH('text', range))) * (values_to_sum)) for advanced partial-match scenarios with more control.

Filter and SUM Combination

Apply AutoFilter to show only rows matching your text criteria, then use SUBTOTAL(9, range) to sum visible cells only.

Tips & Tricks

  • Text criteria are case-insensitive in SUMIF; 'APPLE' and 'apple' produce the same results.
  • Use quotation marks around text criteria: =SUMIF(A:A, 'exact text', B:B) even for exact matches.
  • Combine wildcards creatively: '*' matches any sequence of characters for flexible partial matching.
  • Ensure sum_range and criteria_range have the same number of rows for accurate calculations.

Pro Tips

  • Use absolute references ($A$2:$A$10) in SUMIF when copying formulas to prevent range shifts.
  • Nest SUMIF with IF statements to create conditional logic: =IF(SUM(range)>1000, SUMIF(...), 0).
  • Combine SUMIF with TODAY() or DATE functions to sum based on text patterns matching date criteria dynamically.
  • Use SUMPRODUCT with FIND for case-sensitive text matching when SUMIF's case-insensitive behavior is insufficient.

Troubleshooting

Formula returns 0 instead of expected sum

Verify text criteria exactly matches cell content (check for extra spaces). Ensure sum_range contains numeric values, not text. Test with wildcards: =SUMIF(A:A, '*partial*', B:B) to check if criteria is too specific.

#VALUE! error appears

Check that sum_range contains only numbers or blank cells. If it contains text, convert to numbers first or use SUMPRODUCT instead.

Partial text matches not working

Confirm you're using asterisk wildcards: =SUMIF(A:A, '*text*', B:B). Without asterisks, SUMIF looks for exact matches only.

Formula works in one cell but not when copied

Use absolute references for ranges: =SUMIF($A$2:$A$10, 'text', $B$2:$B$10) to prevent automatic range adjustment when copying.

Related Excel Formulas

Frequently Asked Questions

Can I use SUMIF with multiple text criteria at once?
No, SUMIF handles only one criterion. Use SUMIFS instead: =SUMIFS(sum_range, range1, criteria1, range2, criteria2) to combine multiple text conditions with AND logic. For OR logic, sum multiple SUMIF results: =SUMIF(A:A,'apple',B:B)+SUMIF(A:A,'orange',B:B).
Is SUMIF case-sensitive?
No, SUMIF is case-insensitive by default; 'APPLE', 'Apple', and 'apple' all match identically. If you need case-sensitive matching, use SUMPRODUCT with EXACT or FIND functions instead.
What's the difference between SUMIF and SUMIFS?
SUMIF evaluates one criterion range, while SUMIFS evaluates multiple criterion ranges with AND logic. SUMIFS syntax: =SUMIFS(sum_range, criteria_range1, criteria1, criteria_range2, criteria2). Use SUMIFS when you need to match multiple text conditions simultaneously.
How do I sum if a cell contains text (any text, not specific)?
Use the wildcard pattern '*': =SUMIF(A:A, '*', B:B) to sum all rows where column A contains any text. The '*' wildcard matches any character sequence, so it identifies non-empty text cells.
Can I use SUMIF with dates stored as text?
Yes, but be careful. If dates are stored as text (not formatted as dates), use text wildcards: =SUMIF(A:A, '2024*', B:B) to match dates starting with '2024'. For true date criteria, convert text to dates first using DATEVALUE.

This was one task. ElyxAI handles hundreds.

Sign up