Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Returning Zero when a Referenced Cell is Blank.

Returning Zero When a Referenced Cell is Blank

Written by Allen Wyatt (last updated August 12, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365


2

If you have a formula in a worksheet, and the cell referenced by the formula is blank, then the formula still returns a zero value. For instance, if you have the formula =A3, then the formula returns the contents of cell A3, unless cell A3 is blank. In that case, the formula returns a value of zero.

This seems to be related to the idea that it is impossible for a formula to return a blank value, when "blank" is used synonymously with "empty." You can, however, expand your formula a bit so that it returns an empty string. Instead of using =A3 as your formula, you would use the following:

=IF(ISBLANK(A3),"",A3)

This formula uses ISBLANK, which returns either True or False, depending on whether the referenced cell (A3) is blank or not. The IF function then returns an empty string ("") if A3 is blank, or it uses the value in A3 if A3 is not blank.

Regardless of what the formula returns, you can still use its result in other formulas, and it will work fine. Even if it returns an empty string, it is still treated by other formulas as if it contained zero. In areas where treating the cell as if it contained zero might be problematic (such as when you are charting the results of the formula), then you can modify the formula a bit, as shown here:

=IF(ISBLANK(A3),NA(),A3)

This formula returns the #N/A error if A3 is blank. This error propagates through other formulas that reference the formula, but the #N/A error is ignored completely when charting.

While the above solutions are satisfactory for most people, some people would really like to see a target cell be truly blank if the source cell is blank. For instance, you might want cell B7 to be blank if cell A3 is blank. If you put a formula in cell B7 (as already discussed), then cell B7 is not truly blank—it contains a formula.

If this is your goal—true "blankness"—then you can only achieve it through the use of a macro. The macro will need to check to see if the source cell was changed. If it was, then whatever is in the source needs to be copied to the target cell.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    Dim rMonitor As Range
    Dim rTarget As Range

    Set rMonitor = Range("A3")
    Set rTarget = Range("B7")

    If Not Intersect(Target, rMonitor) Is Nothing Then
        rMonitor.Copy rTarget
    End If

    Set rMonitor = Nothing
    Set rTarget = Nothing
End Sub

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10105) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel here: Returning Zero when a Referenced Cell is Blank.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Can't Save a Macro

Macros can make your use of Word faster and easier than ever before. What do you do, however, when you try to save a ...

Discover More

Adding Automatic Lines

Want an easy way to add lines in your document? You can do it by making sure Word is using one of its AutoFormat features.

Discover More

Turning Off Hyperlink Activation

Does it bother you when you enter a URL and it becomes "active" as soon as you press Enter? Here's how you can turn off ...

Discover More

Best-Selling VBA Tutorial for Beginners Take your Excel knowledge to the next level. With a little background in VBA programming, you can go well beyond basic spreadsheets and functions. Use macros to reduce errors, save time, and integrate with other Microsoft applications. Fully updated for the latest version of Office 365. Check out Microsoft 365 Excel VBA Programming For Dummies today!

More ExcelTips (ribbon)

Summing When the First Character Matches a Value

Summing data is a common need in Excel. Summing lots of data based on a condition that needs to be met can be a bit more ...

Discover More

Reversing Integer Values

Do you need to reverse a series of integer values, such as 5 becomes 1, 4 becomes 2, etc.? There are several ways you can ...

Discover More

Selective Summing

If you want to add up the contents of a range of cells based on what is contained in a different range of cells, you need ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 3 + 7?

2025-06-04 15:00:41

J. Woolley

Define an empty cell as one with no content. My Excel Toolbox includes the following dynamic array function to return its argument with empty values converted to null text (""):
    =EmptyAsText(RangeArray)
RangeArray can be a single cell like A1 or a contiguous range like A1:D9 or the result of a function like UNIQUE that returns an array of cell values.
For example, if A1 is empty
    =A1    -- returns 0
    =EmptyAsText(A1)    -- returns null text ("") which appears empty (blank)
    =ISBLANK(A1)    -- returns TRUE
    =ISBLANK(EmptyAsText(A1))    -- returns FALSE
If A1 is empty, A2 is 1, A3 is 0, and A4 is 1
    =A1:A4    -- returns an array like {0; 1; 0; 1}
    =EmptyAsText(A1:A4)    -- returns an array like {""; 1; 0; 1}
    =UNIQUE(A1:A4)    -- returns an array like {0; 1; 0}
    =EmptyAsText(UNIQUE(A1:A4))    -- returns an array like {""; 1; 0}
Notice UNIQUE(A1:A4) does not appear to return unique values. The result of EmptyAsText(UNIQUE(A1:A4)) looks like three unique values, but the one derived from an empty cell is actually null text.
The result of EmptyAsText(RangeArray) is the same size as RangeArray, but if RangeArray is an extended range (like A:D) it will be restricted so it does not exceed its worksheet's used range. If RangeArray is noncontiguous, #VALUE! is returned.
See https://sites.google.com/view/MyExcelToolbox/


2025-06-02 12:38:36

J. Woolley

Define an empty cell as one with no content and a blank cell as one that appears empty but might have content. So a blank cell might be empty, or it might contain a single apostrophe (') or space character(s) as constant text, or it might have a formula that returns null text ("") or space character(s).
With these definitions for empty and blank, My Excel Toolbox includes the following two functions:
    =IsCellEmpty(Target)
    =IsCellBlank(Target)
IsCellEmpty returns TRUE if Target is empty (no content), FALSE if not.
IsCellBlank returns TRUE if Target is blank (appears empty), FALSE if not.
If Target is a contiguous range with more than one cell, a dynamic array is returned with TRUE/FALSE corresponding to each cell in Target; if Target is an array or a noncontiguous range, #VALUE! is returned.
With these definitions for empty and blank, Excel's ISBLANK function returns TRUE for an empty cell and FALSE for a blank cell that is not empty; therefore, ISBLANK is equivalent to IsCellEmpty except ISBLANK will accept an array as well as a contiguous range. ISBLANK(Target) returns FALSE instead of #VALUE! if Target is a noncontiguous range.
The following formula is equivalent to IsCellBlank(Target)
    =(TRIM(Target)="")
where Target is a range like A1 or A1:D9; however, TRIM will accept an array as well as a contiguous range.
See https://sites.google.com/view/MyExcelToolbox/


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.