Function Problems

Sum Values Based on Text in Excel with SUMIF

Aamir Naveed AkramAamir Naveed Akram Dec 2, 2026 868 views

Question details

Sum numeric values in Excel based on an exact text match or a phrase contained in another cell.

Sum Values Based on Text in Excel with SUMIF
Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet has text in one column and numeric values in another, and the user wants to total values for matching rows.
Observed behavior
The desired result is a total for rows whose text exactly matches a criterion or contains a specified phrase.
Before you start

Identify the text range, the corresponding numeric sum range, and the cell containing your search text. Make sure the criteria and sum ranges cover the same number of rows and columns.

Solution 1Recommended

Sum values for an exact text match

Use this formula when the text in each criteria cell must match the search text exactly.

1
Enter the search text

Type the exact text to match in cell D1.

2
Enter the SUMIF formula

Select an empty cell and enter =SUMIF(A2:A17,D1,B2:B17). Excel checks A2:A17 against D1 and sums the corresponding values in B2:B17.

3
Adjust the references

Replace A2:A17, D1, and B2:B17 with the criteria range, search cell, and sum range in your worksheet.

Sum values for an exact text match
Text matching: SUMIF text criteria are not case-sensitive. Numeric values stored as text in the sum range may not be included.
WPS Spreadsheets

Sum matching text in WPS Spreadsheets

Use SUMIF in WPS Spreadsheets to total values for exact text or partial phrase matches in your workbook.

  1. 1. Open your workbook: Open WPS Office, select Spreadsheets, and open your Excel workbook.
  2. 2. Add the search text: Enter the text you want to match in an empty cell, such as D1.
  3. 3. Enter SUMIF: Select an empty result cell and enter =SUMIF(A2:A17,D1,B2:B17) for an exact match, adjusting the references to your data.
  4. 4. Use wildcards for a phrase: For a partial match, enter =SUMIF(A2:A17,"*"&D1&"*",B2:B17) in the result cell instead.
Sum rows using exact or wildcard text criteriaOpen and edit Microsoft Excel XLSX and XLS filesUse familiar spreadsheet formulas and cell references
microsoft office alternative - wps office

Frequently Asked Questions

How do I sum rows that contain a word anywhere in a cell?

Place the word in D1 and enter =SUMIF(A2:A17,"*"&D1&"*",B2:B17). The asterisks match any text before or after the word.

Does SUMIF distinguish between uppercase and lowercase text?

No. SUMIF text criteria are not case-sensitive, so entries such as "Apple" and "apple" match the same criterion.

Why is my SUMIF total missing some values?

Check that the criteria and sum ranges align, such as A2:A17 and B2:B17, and that the values in the sum range are numeric rather than numbers stored as text.

How can I match a literal asterisk or question mark?

In a SUMIF criterion, place a tilde before the character: ~* matches a literal asterisk and ~? matches a literal question mark.