TL;DR —
IsEmptydoes not look at the cell. It asks one narrow question about a Variant: was it ever given a value? An untouched cell answers yes. A cell holding a formula that returns"", a space, or a lone apostrophe answers no, even though all three look blank. A multi-cell range always answers no, and so does aStringvariable. So before you test for "empty", decide which empty you mean: nothing was ever typed (IsEmpty), nothing is shown (a trimmed length test that skips error cells), or a whole range holds nothing (CountAorCountBlank).
If IsEmpty(Range("A2").Value) Then
Debug.Print "Nothing was ever entered in A2"
End If
This is the first article in a cluster on asking a value what it is: here IsEmpty,
then VarType and TypeName, then IsNull. The cluster idea is that
a VBA value carries a type tag separately from its content, and every one of these tests reads the tag,
not what the value looks like. Empty, Null, Nothing and "" all look like nothing, and they are four
different tags.
What you'll learn
- The mental model: Empty is a tag, not a look
- Three blank-looking cells that IsEmpty says are not empty
- Why IsEmpty is always False for a range or a String variable
- The empty cell that equals 0, and the error cell that crashes
- Which test to use for each meaning of empty
- Empty, Null, Nothing and the empty string side by side
The mental model: Empty is a tag, not a look
A Variant carries two things: a tag that says what kind of value it holds, and the value itself. Empty is
one of those tags. It means no value was ever put here. A Variant you declare and never assign is Empty,
and so is the .Value of a cell that nobody has typed into.
IsEmpty reads only the tag. It never looks at what the cell displays, how it is formatted, or whether a
formula is behind it. That is why it is precise, and also why it surprises people: a cell can look exactly like
an empty cell and still carry a String tag.
Three blank-looking cells that IsEmpty says are not empty
Put these in A2, A3 and A4, leave A5 untouched, and test all four:
| Cell | Contains | Looks | IsEmpty(.Value) |
.Value = "" |
|---|---|---|---|---|
| A2 | =IF(B2="","",B2) |
blank | False | True |
| A3 | one space | blank | False | False |
| A4 | a lone apostrophe ' |
blank | False | True |
| A5 | nothing | blank | True | True |
A2 holds a formula whose result is a zero-length String, so the tag is String, not Empty. A3 holds a one-character String. A4 holds a zero-length text constant: the apostrophe is the cell's prefix character, and the cell is not empty. Only A5 was never given a value.
This is the classic "IsEmpty not working" report. It is working; the question was wrong. Worksheet functions
make the same distinction: ISBLANK is False for A2 to A4, and COUNTA counts all three.
The same tag shows up when you look for the last row: End(xlUp) stops at a formula that returns "",
because that cell is not empty. The last row guide covers that case.
Why IsEmpty is always False for a range or a String variable
IsEmpty only means something for a single Variant. Two common uses never return True:
' A multi-cell range: .Value is an array, and an array is not Empty
If IsEmpty(Range("A2:A100").Value) Then ' never True, even if all are blank
' A typed variable: a String starts as "", a Long as 0, never Empty
Dim name As String
If IsEmpty(name) Then ' never True
For a range, .Value returns a two-dimensional array of Variants, so the tag is "array", never Empty. For a
String, Long or Date variable, the variable starts with a real value ("", 0, midnight on 30 December
1899), so there is nothing to be Empty. Only a Variant can be Empty, and you can reset one with v = Empty.
The data types guide explains why typed variables never start blank.
The empty cell that equals 0, and the error cell that crashes
Comparisons with Empty are generous. VBA converts Empty to whatever it is compared with: 0 next to a number,
"" next to a String. So an empty cell is equal to both:
' A5 is empty
Debug.Print Range("A5").Value = 0 ' True
Debug.Print Range("A5").Value = "" ' True
The first line causes a real data bug. A loop that counts zero sales with If c.Value = 0 also counts every
blank cell as a zero, and a report of "accounts with zero balance" quietly includes the accounts that were never
filled in. Test IsEmpty first when 0 and blank mean different things.
The second trap goes the other way. If a cell holds an error such as #N/A, its .Value is an Error value,
and comparing it with a String fails:
' A6 holds =VLOOKUP(...) that returned #N/A
If Range("A6").Value = "" Then ' Run-time error 13: Type mismatch
A blank check that crashes on the first lookup error is common in sheets fed by VLOOKUP or XLOOKUP. Check
IsError before any comparison. The error handling guide covers error 13 and its
relatives.
Which test to use for each meaning of empty
There are three questions people mean by "is it empty". Each has its own test.
1. Was anything ever entered? Use IsEmpty on the cell's value. This is the right test for "is this
input cell still untouched" or "find the next free row".
If IsEmpty(c.Value) Then c.Value = Date
2. Does the cell show nothing? Treat "", spaces and the apostrophe as blank, but never crash on an error
and never treat 0 as blank:
Function LooksBlank(ByVal c As Range) As Boolean
If IsError(c.Value) Then Exit Function ' #N/A is not blank
LooksBlank = (Len(Trim$(CStr(c.Value))) = 0) ' "", spaces, Empty
End Function
CStr(Empty) is "", so a truly empty cell passes too, and CStr(0) is "0", so a zero does not.
3. Is the whole range empty? Do not loop and do not use IsEmpty. Ask Excel to count:
Dim rng As Range
Set rng = Range("A2:A100")
If Application.WorksheetFunction.CountA(rng) = 0 Then
Debug.Print "Nothing at all in the range, not even formulas"
End If
If Application.WorksheetFunction.CountBlank(rng) = rng.Cells.Count Then
Debug.Print "Every cell is blank or shows an empty string"
End If
CountA counts a formula that returns "" as a value; CountBlank counts it as blank. Pick the one that
matches the question. For a range that may be very large, CountA is also far faster than a loop over cells.
Empty, Null, Nothing and the empty string
These four look alike in the debugger and are tested differently:
| Value | What it means | Where you meet it in Excel | Test |
|---|---|---|---|
| Empty | no value was ever assigned | .Value of an untouched cell; a new Variant |
IsEmpty(v) |
"" |
a String with no characters | a formula returning ""; a cleared TextBox |
Len(v) = 0 |
| Null | unknown or mixed | Font.Bold of a range with mixed formats |
IsNull(v) |
| Nothing | an object variable pointing at no object | a Find that found nothing |
obj Is Nothing |
An empty cell is never Null and never Nothing, so IsNull(Range("A5").Value) is False and Range("A5") is
never Nothing. The IsNull guide covers where Null actually comes from, and the
Nothing guide covers object references.
The judgment call: name the empty you mean
Most blank-cell bugs are not bugs in IsEmpty. They come from code that says "empty" without saying which
kind. The rule that prevents them: write the meaning into the name of the test. IsEmpty for untouched
input cells, a LooksBlank function for data that came from formulas or other people, CountA or
CountBlank for whole ranges, and an IsError guard before any comparison with "" or 0.
When the data comes from an export or a colleague, assume LooksBlank is the right default: imported sheets
are full of spaces and formulas that return "", and almost nobody means "never typed into" when they say a
customer field is empty.
How ExcelMaster helps
Blank-cell logic is easy to write and easy to get subtly wrong: a report that counts blanks as zeros, a loop
that stops at the first formula, a check that crashes on #N/A.
ExcelMaster reads your sheet first, sees
which "blank" cells are truly empty, which hold "" formulas or spaces, and which hold errors, and writes the
check that matches what your data actually contains.
Frequently asked questions
How do I check if a cell is empty in VBA?
Use If IsEmpty(Range("A1").Value) Then. That is True only if nothing was ever entered. If the cell may hold
a formula that returns "" or stray spaces, use Len(Trim$(CStr(c.Value))) = 0 after an IsError check.
Why does IsEmpty return False for a blank cell?
Because the cell is not empty: it holds a formula that returns an empty string, a space, or a lone apostrophe.
IsEmpty reads the value's type tag, not what the cell displays.
How do I check if a range is empty in VBA?
Use Application.WorksheetFunction.CountA(rng) = 0. IsEmpty on a multi-cell range is always False, because
the range's value is an array.
What is the difference between IsEmpty and an empty-string test in VBA?
IsEmpty is True only for a value that was never assigned. = "" is True for an empty cell and for an empty
string, and it raises a Type mismatch error if the cell holds an error value such as #N/A.
Why does my empty cell count as zero?
VBA converts Empty to 0 when you compare it with a number, so If c.Value = 0 is True for an empty cell. Test
IsEmpty(c.Value) first when blank and zero mean different things.
Tested in
Tested in: Excel 365 (Windows 11), VBA 7.1 — last verified 2026-10-04.
Related guides: VBA VarType and TypeName · VBA IsNull · VBA Nothing · VBA IsNumeric · VBA Data Types · VBA Last Row · VBA Error Handling · VBA SpecialCells
