To count non-blank cells in Excel, use =COUNTA(range), which counts all cells containing any value, including text, numbers, errors, and formulas that return an empty string. If you need to exclude cells with formulas that return “” (empty text), use =COUNTIF(range,"<>"&"") or =SUMPRODUCT((range<>"")*1).
Why COUNTA Isn’t Always Enough
COUNTA is the quickest way to count non-empty cells, but it has a quirk: it counts cells containing formulas that return an empty string (“”). For example, if cell A1 contains =IF(B1="","",B1) and B1 is empty, A1 displays as blank but COUNTA(A1) returns 1. This often surprises users when they expect a count of truly visible non-blank cells.
To count only cells that are not empty and not returning “”, use =COUNTIF(A1:A10,"<>"&""). This formula explicitly excludes empty text strings. Alternatively, =SUMPRODUCT((A1:A10<>"")*1) works similarly and is useful in older Excel versions.
How to Use COUNTA in Practice
Assume you have a list of sales in column B (B2:B100) and you want to know how many sales were recorded (non-blank cells).
- Click an empty cell, say D2.
- Type
=COUNTA(B2:B100)and press Enter. - Excel returns the number of non-empty cells in that range.
If your data includes headers, adjust the range to exclude them. For example, if row 1 is a header, use =COUNTA(B2:B100).
COUNTA also counts cells with errors like #N/A, logical values TRUE/FALSE, and even spaces (a space character is considered non-blank). If you want to ignore cells that contain only spaces, use =COUNTIF(range,"<>"&" ") (note the space inside the quotes) or =SUMPRODUCT((TRIM(range)<>")*1).
Counting Non-Blank Cells with Criteria
Sometimes you need to count non-blank cells that also meet another condition. For instance, count non-blank cells in column C where column A equals “Approved”. Use COUNTIFS:
With data in A2:A20 (status) and C2:C20 (values), enter =COUNTIFS(A2:A20,"Approved",C2:C20,"<>").
The “<>” criterion means “not equal to nothing” (i.e., non-blank). This works in Excel 2007 and later. For older versions, use SUMPRODUCT: =SUMPRODUCT((A2:A20="Approved")*(C2:C20<>"")).
Common Problems and Solutions
Problem: COUNTA counts cells with formulas that appear blank. Solution: Use =COUNTIF(range,"<>"&"") as mentioned.
Problem: COUNTA counts cells with spaces. Solution: Use =COUNTIF(range,"<>"&" ") or clean your data with the TRIM function.
Problem: You want to count truly empty cells (the opposite). Use =COUNTBLANK(range) or =COUNTIF(range,""). Note that COUNTBLANK also counts cells with formulas returning “”.
Problem: Counting non-blank cells in a filtered list. Use the SUBTOTAL function: =SUBTOTAL(103,range) counts visible non-blank cells. The 103 code ignores hidden rows, but only counts numbers? Actually, 103 counts visible cells that are not empty, including text. For visible numeric cells only, use 109.
COUNTA vs. COUNT vs. COUNTIF
These three functions serve different purposes:
- COUNT counts only numeric values (numbers, dates, times).
- COUNTA counts all non-empty cells (numbers, text, errors, logicals).
- COUNTIF counts cells that meet a specific condition, such as non-blank with “<>“&””.
For example, if a range contains 5 numbers, 3 text entries, and 2 blanks, COUNT returns 5, COUNTA returns 8, and COUNTIF(range,”<>“) returns 8 (same as COUNTA). Use the one that matches your data type.
Alternatives: SUMPRODUCT and Dynamic Arrays
In Excel 365, you can use the FILTER function to count non-blank cells dynamically: =ROWS(FILTER(A2:A100,A2:A100<>"")). This returns the number of rows that are not blank. However, if the range includes formulas returning “”, those are filtered out because “<>“”” excludes them.
SUMPRODUCT is a classic alternative that works in all versions: =SUMPRODUCT((A2:A100<>"")*1). The *1 converts TRUE/FALSE to 1/0 so SUMPRODUCT can sum them.
For a more robust approach that ignores spaces, use =SUMPRODUCT((TRIM(A2:A100)<>")*1).
Frequently Asked Questions
How do I count non-blank cells in Excel excluding formulas that return blank?
Use =COUNTIF(range,"<>"&""). This counts cells that are not empty and not containing an empty string from a formula. For example, =COUNTIF(A1:A10,"<>"&"").
Why does COUNTA count cells that look empty?
COUNTA counts any cell that contains something, including a formula that returns “” (empty text), a space character, or an apostrophe. These are technically non-empty. To exclude them, use COUNTIF with the “<>“&”” criterion or clean the data.
Can I count non-blank cells in a column based on another column’s condition?
Yes, use COUNTIFS. For example, =COUNTIFS(A2:A20,"Yes",B2:B20,"<>") counts non-blank cells in B where A equals “Yes”.
What is the difference between COUNTA and COUNT?
COUNTA counts all non-empty cells regardless of data type. COUNT counts only cells containing numbers. If you have text or errors, COUNTA includes them, COUNT does not.
How do I count non-blank cells in Google Sheets?
The same functions work: =COUNTA(range) and =COUNTIF(range,"<>"&""). In Google Sheets, COUNTA also counts cells with formulas returning “”, so the COUNTIF approach is still useful.
Does COUNTA count cells with errors?
Yes. Any error value (e.g., #N/A, #VALUE!) is considered a non-blank cell and is counted by COUNTA. If you want to ignore errors, use =COUNTIF(range,"<>#N/A") or a more complex formula with IFERROR.
Related
- Color Matching by Glazing: How It Works
- Command Z on Mac: Undo, Redo & More Shortcuts
- Hot Air Balloon Calendar: Dates, Festivals, and Events
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Excel COUNTIF for Multiple Values: How to UseTo count cells matching any of several values in Excel, use SUM(COUNTIF(range, {"value1","value2",...})) as an array formula (or…
- Excel Weighted Average: Formula & Percentage TipsThe Excel formula for a weighted average percentage is =SUMPRODUCT(values, weights)/SUM(weights), where values are the percentages and weights…
- Change Text Filter to Number Filter in Excel?To change a Text Filters menu to Number Filters in Excel, convert the values in that column from…
- How to Merge Two Sheets in Excel with VLOOKUP FormulasTo merge information from two Excel sheets by a shared ID, add a column to the sheet you…
- ROUNDUP Number in Excel: 10 Useful Ways to Round UpTo round a number up in Excel, use =ROUNDUP(number,num_digits); for example, with a value in A2, =ROUNDUP(A2,2) rounds…
- How to Sort Dates in Excel Without Splitting RowsTo sort dates in Excel, select a cell in your data, open Data > Sort, choose the date…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.