Google Sheets COUNTIF Not Blank: 3 Easy Ways

How-to basics · Updated November 22, 2026

To count non-blank cells in Google Sheets, use =COUNTIF(range, "<>"). This counts every cell in the range that is not truly empty. For example, =COUNTIF(A2:A100, "<>") returns the number of cells in A2:A100 containing any value, including text, numbers, and formulas that return an empty string.

Why COUNTIF with “<>” Works

Google Sheets’ COUNTIF function accepts a condition as its second argument. The condition "<>" means “not equal to nothing” — in spreadsheet terms, it matches any cell that is not blank. This is the simplest and most common way to count non-empty cells because it requires no helper columns and works on any data type (text, numbers, dates, errors).

Note that COUNTIF treats cells containing a formula that returns an empty string ("") as non-blank. If your range has formulas like =IF(A1="","",B1), those cells will be counted even though they appear blank. For a stricter count of cells that are truly empty, use COUNTIF with "?*" (explained below) or switch to COUNTA with a filter.

How to Count Non-Blank Cells (Step-by-Step)

  1. Open your Google Sheet in a web browser.
  2. Click on an empty cell where you want the result.
  3. Type =COUNTIF(range, "<>") — replace range with your actual cell range (e.g., B2:B50).
  4. Press Enter. The cell shows the count of non-blank cells in that range.

Example: With names in A2:A20 and sales in B2:B20, to count how many sales entries exist, use =COUNTIF(B2:B20, "<>"). If B2:B20 has 15 filled cells and 4 empty, the formula returns 15.

Alternative: Using COUNTA (and Its Caveat)

COUNTA counts all non-empty cells in a range, including errors and text. It is simpler: =COUNTA(A2:A100). However, COUNTA also counts cells with formulas that return an empty string, just like COUNTIF. The key difference is that COUNTA cannot accept a condition — it counts everything that is not blank. So if you need to count non-blank cells that also meet another criterion (e.g., only numbers greater than 10), you must use COUNTIFS or COUNTIF.

For a strict count of cells that are not blank and also contain at least one character, use =COUNTIF(range, "?*"). This counts cells with at least one character (including spaces), excluding truly empty cells and cells with empty-string formulas. But note: it also excludes cells with only a zero-length string.

Counting Non-Blank Cells with Additional Criteria

If you need to count non-blank cells that also meet another condition, use COUNTIFS. For example, to count non-blank cells in B2:B20 where the corresponding value in C2:C20 is “Yes”:

Assume data in C2:C20 has “Yes” or “No”. The formula =COUNTIFS(B2:B20, "<>", C2:C20, "Yes") returns the count of rows where B is non-blank and C is “Yes”. If B2:B20 has 10 non-blank and C2:C20 has 6 “Yes” among those, the result is 6.

You can also use COUNTIF with wildcards for text criteria, but for non-blank plus another condition, COUNTIFS is cleaner.

Common Problems and Misconceptions

  • Counting spaces as non-blank: A cell containing a single space (” “) is counted as non-blank by COUNTIF and COUNTA. To exclude spaces, use =COUNTIF(range, "?*") — this requires at least one character, but a space is a character, so it still counts. To exclude spaces, you’d need a more complex array formula, which is rarely necessary.
  • Using "<>" with numbers: Works fine; numbers are non-blank.
  • Blank cells with formulas: If a formula returns "", it’s technically not blank. Use COUNTIF with "?*" to ignore those, but be aware it also ignores cells with only spaces.
  • Counting across multiple ranges: COUNTIF only handles one range. For multiple ranges, use COUNTIF for each and add them, or use SUMPRODUCT with LEN for a more advanced solution.

Comparison: COUNTIF vs. COUNTA vs. COUNTBLANK

Function Counts Example
COUNTIF(range, "<>") Non-blank cells (including empty-string formulas) =COUNTIF(A2:A100, "<>")
COUNTA(range) All non-empty cells (same as above) =COUNTA(A2:A100)
COUNTBLANK(range) Truly blank cells (excluding empty-string formulas) =COUNTBLANK(A2:A100)
COUNTIF(range, "?*") Cells with at least one character (excluding empty-string formulas) =COUNTIF(A2:A100, "?*")

Use COUNTIF when you need a condition; use COUNTA for a simple non-blank count; use COUNTBLANK to count truly empty cells. Note that COUNTBLANK counts cells with empty-string formulas as blank, which is opposite of COUNTIF.

Frequently Asked Questions

Does COUNTIF count cells with formulas that return “”?

Yes, COUNTIF(range, "<>") counts cells with formulas that return an empty string because the cell itself is not blank — it contains a formula. If you want to exclude those, use =COUNTIF(range, "?*"), which requires at least one character in the result.

How do I count non-blank cells in multiple columns?

You cannot use COUNTIF directly on multiple ranges. Instead, add separate counts: =COUNTIF(A2:A100, "<>") + COUNTIF(B2:B100, "<>"). For a single count across a 2D range, use =SUMPRODUCT((A2:C100<>"")*1), but that counts each cell individually.

Why does my COUNTIF return 0 even though I have data?

Check that your range is correct and that there are no leading/trailing spaces in the criteria. Also, if your data contains only numbers that are formatted as text, they are still non-blank. A common mistake is using "<>" with a space inside the quotes — ensure it’s exactly "<>" with no space.

Can I count non-blank cells that are also not equal to a specific value?

Yes, use COUNTIFS: =COUNTIFS(A2:A100, "<>", A2:A100, "<>", B2:B100, "Exclude") — but that’s redundant. Better: =COUNTIFS(A2:A100, "<>", B2:B100, "<>Exclude"). This counts rows where A is non-blank and B is not “Exclude”.

What’s the difference between COUNTIF and COUNTA for non-blank?

Functionally, for a simple non-blank count, they return the same result. The difference is that COUNTA cannot take a condition, so if you need to count non-blank cells that also meet another criterion, you must use COUNTIF or COUNTIFS. Also, COUNTA counts any non-empty cell, including errors, whereas COUNTIF with "<>" also counts errors.

Performance and Best Practices

For large datasets (tens of thousands of rows), COUNTIF is efficient. If you find your sheet slow, avoid array formulas like SUMPRODUCT over entire columns (e.g., A:A) — instead limit the range to the actual data area. Also, note that COUNTIF is not case-sensitive and ignores leading/trailing spaces in criteria, but not in data.

If you need to count non-blank cells in a filtered list, use SUBTOTAL with function number 103 (COUNTA) for visible cells only: =SUBTOTAL(103, A2:A100). This counts non-blank cells in the visible range after filtering.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.