Excel COUNTIF and SUMIF
COUNTIF and SUMIF let you count or add up cells that meet a single condition, forming the basis of quick conditional reporting in Excel.
Counting Cells That Meet a Condition: COUNTIF
COUNTIF looks through a range and counts how many cells satisfy a criteria you specify. Its syntax is COUNTIF(range, criteria), where range is the cells to check and criteria is the condition, written as a number, text in quotes, or a comparison.
Example
=COUNTIF(A:A,">10")Adding Values That Meet a Condition: SUMIF
SUMIF works the same way but returns a total instead of a count. Its syntax is SUMIF(range, criteria, [sum_range]): range is checked against criteria, and the matching amounts are pulled from sum_range, which can be a different set of cells than range itself.
Example
=SUMIF(A:A,"Yes",B:B)In that example, Excel checks every cell in column A for the text "Yes", and for every row where it finds a match, it adds the corresponding value from column B into the total.
Writing Criteria Correctly
- "Yes" matches the exact text Yes.
- ">100" matches any value greater than 100; comparison operators must be inside the quotes.
- "<>0" matches anything that is not zero.
- "A*" matches any text starting with the letter A, using * as a wildcard for any number of characters.
- ">"&C1 builds a dynamic criteria from the value in C1 by joining text and a cell reference with &.