In Excel: Use If IsEmpty(ws.Range("A1").Value) Then for a truly untouched cell, or If ws.Range("A1").Value = "" Then when a formula returning "" should also count as blank.
VBA macro: Check Whether a Cell Is Empty
Sub CountEmptyCells()
Dim ws As Worksheet
Dim cell As Range
Dim emptyCount As Long
Set ws = ActiveSheet
For Each cell In ws.Range("A1:A20")
If IsEmpty(cell.Value) Then
emptyCount = emptyCount + 1
cell.Interior.Color = RGB(255, 235, 156)
End If
Next cell
If emptyCount = 0 Then
MsgBox "No empty cells in A1:A20.", vbInformation
Else
MsgBox emptyCount & " empty cell(s) highlighted.", vbExclamation
End If
End SubIsEmpty is True only for a genuinely untouched cell. A cell holding =IF(A1="","",A1) looks blank on screen but contains a formula, so IsEmpty returns False while .Value = "" returns True — the two tests answer different questions.
How to run this macro
- Press Alt + F11 to open the VBA editor.
- Insert > Module.
- Paste the code above.
- Press
F5, or close the editor and run it from Developer > Macros. - Save the file as .xlsm so the macro is kept.
Decide which blank you mean: never-typed-into, or displaying nothing.
For never-typed-into, test If IsEmpty(cell.Value) Then.
For displaying nothing, test If cell.Value = "" Then, or equivalently If Len(cell.Value) = 0 Then.
For a whole range or row, use If Application.WorksheetFunction.CountA(rng) = 0 Then instead of looping.
Test against real data containing at least one formula-blank, because that is the case where the two tests disagree.
What this does
Excel has more than one kind of blank, which is why this question has more than one answer. A cell that has never been typed into is Empty — IsEmpty returns True and it holds no value at all. A cell containing a formula that evaluates to "" looks identical on screen but is not empty: it holds a formula, so IsEmpty returns False while comparing .Value to "" returns True. A cell holding a single space is empty to neither test. Which test to use follows from which of those you mean. For a whole range there is a fourth option: Application.WorksheetFunction.CountA(rng) = 0 answers "is every cell in this range blank" in one call, without a loop, and is what row-deletion macros should use rather than testing one column and hoping. Len(cell.Value) = 0 is a common shorthand that behaves like the "" comparison and reads a little more clearly for text. The same idea underpins a lot of everyday Excel work, so the few minutes spent getting it right here pay back across every sheet you build afterwards. Treat it as a pattern, not a one-off, and it stops being something you look up and starts being something you reach for. The difference between a quick fix and a sheet you can trust is the extra minute you spend validating “excel vba isempty”. Start on a copy or a tiny sample, keep the affected cells visible, and compare the result with the tool above before you touch the real workbook. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. The point is a workflow that saves repeating the same clicks every week, but the practical win is that someone else can open the file and understand what happened without asking you.
A worked example
You need to flag gaps in an ID column before importing the sheet. Sub CountEmptyCells() walks A1:A20, tests each cell with IsEmpty, shades the blanks pale amber and reports the total. Run it against a column where one cell holds =IF(B1="","",B1) and that cell will not be highlighted — correctly, because it is not empty, it merely displays nothing. If your import treats both as missing, swap the test to If cell.Value = "" Then and it will catch both. For the different question of whether an entire row is blank, drop the loop: If Application.WorksheetFunction.CountA(ws.Rows(i)) = 0 Then covers all 16,384 columns at once, which is why it is the right guard before deleting a row. Nearly every data-cleaning macro turns on this test, and getting it wrong is quiet rather than loud: rows are skipped or deleted based on a definition of "blank" that does not match the one in your head. Choosing deliberately between IsEmpty, the "" comparison and CountA is what makes the result predictable. If there is any chance you will reuse this, drop it into a small template tab right now: a labelled input area on the left and the formula beside it, checked once against the tool above. Next time the same question comes up, the answer is a single paste away instead of a rebuild from memory.
In Google Sheets
If you are in Google Sheets rather than Excel, the good news is that the formula shown here is identical and the workflow barely changes — menus sit across the top instead of in a ribbon, and a few function names differ slightly, but anything you build here moves across with little or no rework. Nothing on this page is behind a login: the tool runs entirely in your browser, the formula is shown in full with one-click copy, and the steps work the same on Windows and Mac. That is the whole promise here — the exact answer, a way to prove it on your own numbers, and just enough context to make it stick. The short version of “excel vba isempty”: the answer is at the top of this page, the tool proves it on your own numbers, and the sections above explain why it holds so the next variation does not stump you. Excel rewards people who reference cells instead of typing values and who keep inputs separate from formulas, because that is what makes a result you can audit months later. Build it once, deliberately, with the live tool as a check, and you convert a one-off lookup into a reusable skill — which is the whole point of learning the why and not just the what.
Common mistakes
- Using IsEmpty on a formula cell and concluding the sheet is populated. IsEmpty asks whether the cell holds anything at all, and a formula counts — even one that shows nothing.
- Passing a multi-cell range to IsEmpty. It evaluates the first cell only and quietly reports on that, giving a confident wrong answer about the rest. CountA is the range-level test.
- Missing cells that contain a single space. Neither test treats " " as blank; if imported data might carry one, compare Trim(cell.Value) = "" instead.
- Testing only column A before deleting a row. A row can have an empty A and real data in D — CountA over the whole row is the check that prevents destroying it.
- Confusing VBA's IsEmpty with the worksheet
ISBLANKfunction. They are different tools with similar names; from VBA the equivalent is Application.WorksheetFunction.CountBlank or a direct IsEmpty test.
Frequently asked questions
What is the difference between IsEmpty and Value = ""?
IsEmpty is True only for a cell with nothing in it at all. Value = "" is also True for a cell holding a formula that returns an empty string. Pick based on whether a formula-blank should count.
How do I check whether an entire range is blank?
If Application.WorksheetFunction.CountA(ws.Range("A1:D100")) = 0 Then. CountA counts non-empty cells, so zero means every cell in the range is blank, and it needs no loop.
Is there an ISBLANK in VBA?
Not by that name. IsEmpty is the closest VBA equivalent; the worksheet function is reachable as Application.WorksheetFunction.CountBlank(rng) if you specifically want Excel's own definition.
Why does a cell that looks empty fail my test?
It almost certainly holds a formula returning "", or a single space left by an import. Check with Len(cell.Formula) and Len(cell.Value) — if they differ, a formula is present.