Excel VBA ISBLANK

This guide treats “excel vba isblank” the way busy spreadsheet users actually want it: answer first, then the reasoning. It is written for Excel but calls out every place Google Sheets differs, and the platform toggle at the top switches all shortcuts between Windows and Mac so nothing here assumes the keyboard you are not on.

Exact answer

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 Sub

IsEmpty 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

  1. Press Alt + F11 to open the VBA editor.
  2. Insert > Module.
  3. Paste the code above.
  4. Press F5, or close the editor and run it from Developer > Macros.
  5. Save the file as .xlsm so the macro is kept.
Annotated stepsExcel
1

Decide which blank you mean: never-typed-into, or displaying nothing.

2

For never-typed-into, test If IsEmpty(cell.Value) Then.

3

For displaying nothing, test If cell.Value = "" Then, or equivalently If Len(cell.Value) = 0 Then.

4

For a whole range or row, use If Application.WorksheetFunction.CountA(rng) = 0 Then instead of looping.

5

Test against real data containing at least one formula-blank, because that is the case where the two tests disagree.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

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 isblank”. Start on a copy or a tiny sample, keep the affected blanks 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. A practical tip before you scale it up: build it once on a small block of test data, confirm the number against the tool on this page, and only then point it at your real sheet. That one habit catches almost every mistake while it is still cheap to fix, long before a wrong figure reaches a report or a colleague.

In Google Sheets

Google Sheets handles this almost identically to Excel. The formula syntax above is the same, and the menu lives under a slightly different label rather than a ribbon tab. Use the platform toggle at the top of the page to switch every keyboard shortcut between Windows and Mac, and expect at most cosmetic differences in naming. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top, the tool proves it, and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. Treat “excel vba isblank” as a small building block rather than a chore. Once the inputs sit in their own cells and the formula reads from them, the same setup answers a dozen related questions with a tweak, and Excel keeps every dependent figure current as the data changes. The tool above is there so you can rehearse and verify before committing anything to a real workbook; the steps and worked example are there so the logic sticks. Get it right once and it stops costing you time — it starts saving it, every time the question comes back around.

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 ISBLANK function. 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.