FormulaCraft

How to sum cells whose label contains a word in Excel and Google Sheets

Topic:SUM & aggregation
Excel & Google Sheets
=SUMIF(A2:A5,"*apple*",B2:B5)

Verified example

Computed by a real spreadsheet engine on the sample data below.

ProductSales
Green Apple120
Banana80
Pineapple95
Mango60

=SUMIF(A2:A5,"*apple*",B2:B5)215

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

Step by step

  1. 1Place your labels (text) in one column (e.g., A) and the values to sum in an adjacent column (e.g., B).
  2. 2In an empty cell type =SUMIF( then select the label range A2:A100.
  3. 3For the criteria, enter the wildcard pattern in quotes, such as "*apple*" to match any label containing 'apple'.
  4. 4Select the sum range B2:B100 as the third argument and close the parenthesis.
  5. 5Press Enter — the formula sums every row whose label contains the word.

Tips

Need it for your exact data?

Describe your columns in plain English and get the precise formula for your sheet, with the right Excel or Sheets syntax.

Frequently asked

Is the partial-text match case-sensitive?

No, SUMIF wildcard matching is case-insensitive in both Excel and Google Sheets.

What if my values are in a non-adjacent column?

SUMIF handles non-adjacent sum ranges fine — just specify the correct column as the third argument regardless of its position.

More on SUM & aggregation

See all →

Formulas used

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: