Sub topic 11
Counting and Summing Blank and Non-Blank Cells
Assume you can enter formulas, use ranges such as A2:A100, and distinguish text, numbers, and dates. This chapter focuses on testing whether a cell contains a value.
Blank criteria are useful when a missing product, owner, or status needs attention. Non-blank criteria help you count or total only completed records.
Match blank cells
In Google Sheets, the criterion "" means “empty.” Use it with COUNTIFS to count rows where a column is blank.
=COUNTIFS(B2:B100, "")This counts rows where the cells in B2:B100 are blank.
You can combine the blank test with another condition. This formula counts West-region rows whose Product cell is blank:
=COUNTIFS(A2:A100, "West", B2:B100, "")Every criteria pair must be true. The row must be in the West region and have a blank Product cell.
SUMIFS uses the same test, but adds numbers from a sum range:
=SUMIFS(E2:E100, B2:B100, "")This adds Revenue for rows where Product is blank. Empty cells in the Revenue range contribute zero.
Match non-blank cells
The criterion "<>” means “not equal to blank,” or “contains something.” Use it to count rows with a value:
=COUNTIFS(A2:A100, "West", B2:B100, "<>")This counts West-region rows whose Product cell is not blank.
To total Revenue only for rows with a Product value, use:
=SUMIFS(E2:E100, B2:B100, "<>")The test checks B2:B100, while E2:E100 supplies the values to add.
A cell containing a formula that returns an empty string is different from a physically empty cell. Functions can treat these cases differently, so test a sample if your sheet uses formulas to display empty-looking results.
Combine blank tests with other conditions
Suppose column A contains Region, column B contains Product, column D contains Units, and column E contains Revenue. To count West rows with no Product but at least 10 Units, write:
=COUNTIFS(A2:A100, "West", B2:B100, "", D2:D100, ">=10")To sum their Revenue instead:
=SUMIFS(E2:E100, A2:A100, "West", B2:B100, "", D2:D100, ">=10")Each range must cover the same rows. A mismatch, such as A2:A100 paired with B2:B90, can produce incorrect results or an error.
Debug common mistakes
- Use
"", not the word"blank", to match empty cells. - Use
"<>", not"not blank", to match non-empty cells. - Check that every criteria range has the same height.
- Confirm that the sum range contains numbers.
- If the result seems wrong, inspect cells containing formulas that return
"".
Exercise
Write a formula that counts East-region rows where the Status column F is not blank.
Show answer
=COUNTIFS(A2:A100, "East", F2:F100, "<>")