COUNTA Counting Blank Cells? How to Fix It
In this article
COUNTA counts a cell as non-blank whenever it contains anything at all, including a formula that returns an empty string, a lone space or non-breaking space, an apostrophe left over from text entry, or a zero-length value produced by a link or import. The fix is to identify what is actually in those "blank" cells and then either change the formula so it ignores zero-length results or clean the data so the cells are genuinely empty. COUNTA itself has no option to ignore them, so in most cases you either clean the data or switch functions.
What You'll Need
- Excel on desktop (Windows or Mac) or Excel for the web; the steps below use the desktop menus, and labels can differ slightly by version, device or region.
- The workbook containing the formula that returns the wrong count.
- A spare empty cell or two to the side of your data for testing formulas.
- Optional: conditional formatting, if you want to see the problem cells highlighted rather than hunting for them.
Step-by-Step
- Confirm the cells really are the problem. Click one cell that COUNTA is counting and press Delete. If the total drops by one, the cell held something. If it does not, undo with Ctrl+Z (Cmd+Z on Mac) and re-check the range: the extra count may be coming from a different area than you think, especially if the range was dragged too far down or across.
- Look for a formula returning an empty string. This is the most common cause. A formula such as
=IF(A2="","",A2)looks blank on screen but COUNTA sees the formula and counts the cell. In an empty cell type=ISTEXT(B2)(pointing at a suspect cell). A TRUE result with a blank-looking cell confirms it. Also check the formula bar: if anything is shown there, the cell is not empty. - Count the truly empty cells for comparison. In a spare cell, enter
=COUNTBLANK(B2:B100)with your real range. If COUNTA plus COUNTBLANK does not add up to the total number of cells in the range, you have a mismatch worth investigating, usually from merged cells or a range that includes hidden rows. - Test for a space or non-breaking space. Select a suspect cell and look at the formula bar with the cell selected; a single space is easy to miss because the text starts after the caret. Type
=LEN(B2)next to it. A result of 1 when the cell looks empty means a space; a result of 1 that survives=TRIM(B2)being applied usually means a non-breaking space, which TRIM does not remove. - Remove stray spaces from pasted data. Select the column, then use Ctrl+H (Cmd+H on Mac) to open Find and Replace. Put a single space in Find what, leave Replace with empty, and choose Replace All. Do this on a copy of the sheet first, because it also removes the spaces between words. For a non-breaking space, copy one from a problem cell, paste it into Find what, and replace with nothing.
- Use a helper column with TRIM and CLEAN. In a free column enter
=TRIM(CLEAN(B2))and fill down. Then point your counting formula at the helper column instead, using=COUNTIF(C2:C100,"?*"). The"?*"criterion counts cells containing at least one character and ignores empty strings, spaces-only results and genuinely blank cells. - Replace COUNTA with COUNTIF where you can. For counting text entries only,
=COUNTIF(range,"?*")is the most reliable read. For numbers only, use=COUNT(range). For non-empty cells generally,=SUMPRODUCT(--(LEN(TRIM(range))>0))returns the count of cells that contain something visible, which is usually what people assume COUNTA does. - Clean the source if possible. If the blanks come from an import, a linked table or a query, fix the source so empty fields arrive as truly null rather than as zero-length strings. Re-run the import or refresh the connection and check the count again. Fixing the source stops the problem returning next month.
- Make the problem visible. Select the range and apply conditional formatting with a formula rule such as
=AND(LEN(B2)=0,ISTEXT(B2)). Cells that look blank but hold text (including empty strings) will highlight, so you can delete or clean them directly. - Check for deleted-but-not-empty content. A cell that once held a note or comment, or that has a leftover fill or border, is still counted by COUNTA if it holds a value; formatting alone does not affect the count. Review merged cells too, since the count falls on the top-left cell of the merge.
Common Mistakes
Assuming Delete clears the value. Pressing Delete removes the contents, but if the cell contains a formula, Delete removes the formula. If you meant to blank the result but keep the formula, you need the formula to return a real blank, which it cannot do: an empty string is still content to COUNTA.
Trimming the wrong column. TRIM and CLEAN in a helper column only help if the counting formula points at that helper column. Leaving the original range in place changes nothing.
Using COUNTIF with a blank criterion. =COUNTIF(range,"") counts both empty cells and cells whose formula returns an empty string, so it is not a clean test for empty.
Forgetting non-breaking spaces. Data pasted from web pages and some exports uses a non-breaking space, which TRIM ignores and which looks identical to nothing. If your cleaned count is still too high, test for it specifically.
Dragging the range into empty rows. A range that extends past your data includes empty cells, which counters ignore, but it can also include stray values far down the sheet. Use a whole-column reference or a fixed table reference deliberately.
Tips
Convert your data to an Excel Table ( Ctrl + T ) and build the formula against structured references such as ; the range then grows and shrinks with the data automatically.
Keep a small "data check" panel at the top of sheets you share: one cell for COUNTA, one for COUNTBLANK, one for COUNTIF with "?*". When the numbers diverge, you know the data has ghost values before anyone reports a wrong total.
When importing, prefer Power Query over copy and paste. It keeps empty fields empty instead of converting them to empty strings, which is the root cause of most phantom blanks.
Troubleshooting
The count is still too high after trimming. Test =LEN(cell) on each remaining offender. A length above zero that survives TRIM points to a non-breaking space or another invisible character; replace it directly with Find and Replace.
COUNTIF with "?*" returns zero on a column you know has text. The criterion must be typed inside quotes exactly as shown, and the range must be the text column, not a header row. Check the formula bar for smart quotes pasted from a document; retype the quotes.
Numbers are being skipped. "?*" counts text, so numeric cells may not register in some setups. For a mixed column use the SUMPRODUCT version, which counts any cell with visible content.
The count changes when you filter. COUNTA ignores filtering and counts hidden rows. If you want visible rows only, use =SUBTOTAL(103,range), which counts non-empty visible cells.
Nothing you try works and the sheet is shared. Make a copy, run the checks on the copy, and compare. If the copy is clean, the original likely contains linked values from another workbook that refresh when opened.
Frequently Asked Questions
Why does COUNTA count a cell with a formula that shows nothing?
Because the cell contains a formula, and COUNTA counts formulas even when their result is an empty string. The cell is not empty; it holds a value that happens to display as nothing.
What is the difference between COUNTA and COUNTBLANK?
COUNTA counts cells with any content, including empty strings. COUNTBLANK counts truly empty cells and cells whose formula returns an empty string, which is why the two do not always add up to the range size.
Does deleting a space fix the count?
Yes. Once the space is removed the cell is empty and COUNTA stops counting it. Use Find and Replace for a whole column rather than deleting cell by cell.
Can COUNTA ignore blanks with a setting?
No. There is no toggle for this. You either clean the data or switch to COUNTIF, COUNT or SUMPRODUCT with a length test.
Why does a cell that looks empty have a length of 1?
It contains a space or a non-breaking space. TRIM removes ordinary spaces but not non-breaking ones, so replace those directly.
Why does the count differ between two people looking at the same file?
Usually one has recalculated the sheet and the other has not, or the file is open in a different app that handles empty strings differently. Press F9 to recalculate, then compare again.