|
Home > Structure > Worksheets > Blank Cells Excel Blank Cells Not Blank
|

In some Excel worksheets, some cells might look blank, but Excel formulas count them as containing data. Why does that happen?
In the video and notes below, I show how you can fix those "blank" cells, so your formulas and navigation shortcuts work correctly!
In this short video, I show how to fix cells that look blank, but aren't really blank. If you run into this problem frequently, I also show how to record and run a macro, that will help you fix those cell quickly.
Here are 3 reasons that worksheet cells can look blank/empty:
Some cells look empty, but if you click on the cell to select it, you can see a formula or value in the Formula Bar.
In the sections below, I've described 3 situations that cause this type of "empty" cells on a worksheet.
For example, in the screen shot below, the formulas in column C return an empty string (""), if the value in column B is not an odd number:
In each row with an even number, the cell in column C looks empty.
However, when you click on the "empty" cell, the formula appears in the formula bar.

On some sheets, the Display Zeros setting might be turned off, in Excel Options.
If cells on that sheet contain a zero, or a formula that returns a zero, the cell will look empty. However, when you click on the "empty" cell, the cell contents appear in the formula bar.

For some cells, there could be cell, font or number formatting that hides the contents. For example, in the screen shot below:

Sometimes cells look blank, and you can't see anything in the formula bar. However, the COUNTA function still counts those "empty" cells!
In the sections below, I show 2 situations that cause this type of "empty" cells on a worksheet:
After that, I show:
If you import data to Excel, such as query results from Microsoft Access, some cells might look empty, but Excel treats them as containing empty strings.
In the example shown below, there is a small table, copied from Access, with 3 cells – that appear blank - C4, C5 and C7.

In the Access database, those cells might have had a zero length string or a null value.
The "empty" cells contain a hidden apostrophe, and that's why Excel counts them
In some cases, the problem "empty" cells are created within Excel, if cells are copied, and pasted as values.
The example below shows how this situation can occur.
First, follow the steps below, to create cells that look blank, because they contains formulas that return empty strings.

Next, follow these steps to create the blank cells problem:
Now there is a blank cell problem:
So, you can create the same issue by pasting Excel formulas as values, if some of the cells contain an empty string

To see apostrophes in cells with hidden content, follow the steps below, to turn on an Excel option:

To test the setting change:

In the sections below, there are 3 ways you can fix cells that look blank, but aren't really blank. All 3 solutions are quick and easy, so use the method that you prefer.
I usually use the Text to Columns method.
Here's a quick way to fix cells that look blank, but aren't. This was suggested by Ed Ferraro, in my Contextures blog comments.
Follow the steps below, to fix the problem with Excel's Text to Columns feature:
That removes the hidden content, and the cells are really empty.
Here is another quick solution, posted by Gobish, in the Contextures blog comments.

That technique also solves the problem, and the cells are really empty.
To fix the problem, so the “blank” cells are recognized as blank, you can use the Find and Replace command, in two steps.
| ▶ |
Note: You can record a macro while you fix the cells, and run that macro later, if you encounter a similar problem. See my macro code, below. |

This technique also solves the problem, and the cells are really empty.

In addition to the COUNTA problem, there is a navigation problem with these cells that look empty.
Here is an Excel macro that fixes the blank cells, by using the Find and Replace command. It works on the selected cells in the active worksheet.
Store the macro code on a regular worksheet module.
Sub FixBlankCells()
' Make blank cells from database really blank
With Selection
.Replace What:="", _
Replacement:="$", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
.Replace What:="$", _
Replacement:="", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False
End With
End Sub
To work with the sample data, and run the macro, you can download the Fix Blank Cells in Excel sample workbook. The file is in xlsm format, zipped, and contains macros. You’ll have to enable macros if you want to test the Fix Blank Cells code in the sample file.
More Ways to Count in Excel |
Last updated: May 23, 2024 3:44 PM