Excel beginner

How to Sum Values Based on a Condition in Excel?

The SUMIF function allows you to sum values in one column based on criteria in another column, simplifying data analysis.

Formula Genius can generate a draft from a plain-English prompt. Supported formulas can be checked with sample cases; review the coverage on the result.

The formula

Prompt

"Sum values in column B where column A equals a specific value"

Excel
=SUMIF(A:A, "criteria", B:B)

This formula sums all values in column B where the corresponding value in column A matches the specified criteria.

Step-by-step breakdown

  1. A:A specifies the range to evaluate for the criteria.
  2. criteria is the condition that must be met (e.g., a specific text or number).
  3. B:B specifies the range of values to sum if the criteria is met.
  4. The function returns the total of all matching values from column B.

Edge cases & warnings

  • If there are no matches, the formula returns 0.
  • If the criteria is a number, ensure it is not enclosed in quotes.
  • Using wildcards in the criteria may lead to unexpected results if not formatted correctly.

Examples

Prompt

"A1:A5 contains {"Apple", "Banana", "Apple", "Orange", "Banana"} and B1:B5 contains {10, 20, 30, 40, 50}, criteria is "Apple""

Excel
40
Prompt

"A1:A5 contains {"X", "Y", "X", "Z", "Y"} and B1:B5 contains {5, 15, 25, 35, 45}, criteria is "Y""

Excel
60

Frequently asked questions

Can I use SUMIF with multiple criteria?

For multiple criteria, use the SUMIFS function instead.

What happens if my criteria is not found?

The formula will return 0 if there are no matches.

Can I use cell references for criteria?

Yes, you can reference a cell that contains the criteria instead of typing it directly.

Can't find what you need?

Describe a formula in plain English. Formula Genius drafts and explains it, and can check supported formulas on sample cases.