Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Returning Zero When a Referenced Cell is Blank.

Returning Zero when a Referenced Cell is Blank

by Allen Wyatt
(last updated July 11, 2017)


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:


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:


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


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 (2174) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) 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. ...


Entering a Page Break from the Keyboard

Need to force Word to move text to the top of the next page? It's easy when you use the keyboard shortcut for a page break.

Discover More

Monthly Close-Out Dates

If your company closes out its accounting months at the end of each calendar quarter, figuring out the proper closing ...

Discover More

Printing Only Selected Pages

I often need to print only select pages of a document, rather than the whole thing. Word makes it easy to be judicious in ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (menu)

Adding Dashes between Letters

When processing some text data, you may need to perform some esoteric function, such as adding dashes between letters. ...

Discover More

Counting Non-Blank Cells

Need to count the number of cells in a range that are not blank? You can use the COUNTA function of a more complex ...

Discover More

Averaging a Non-Contiguous Range

Figuring out how to average data that is in a contiguous range of cells is easy. When the data is spread over a group of ...

Discover More

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

View most recent newsletter.


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}] 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 nine more than 2?

2019-04-17 16:37:59

Gene Ambeau

Under Options, Advanced, Display Options, turn off the setting "Show a zero in cells that have a zero value"

2018-12-05 03:41:02

Alan von Elstein

Hi Billie,
You could do the same basic idea as Allen's formula
Alan Elston

2018-12-04 17:23:47


If I put the formula =Month(B4) in B3 and have a date in B4 it will display the month # in B3, however if B4 is blank it will always display a 1 in B3. How do I correct the blank cell error?

2018-04-08 13:28:27


I'm very new to excel and I believe my question should be very simple for those more experienced.

Simple formula: C3-C4

But if C4 is blank, I want the formula to return a factor of zero. How do I do this?

2018-02-19 16:31:00

Frank Culley

i am trying to average non-contiguous cells (same column) but there is other data in other cells in the column.
The result goes in a different column.
I need a formula that returns a result of zero (or a blank cell) if there is a zero in the data being averaged.
Frank Culley

2017-07-11 16:04:29

Neplixam Bristo

I am using data on sheet 1 . and using vlookup formula in sheet 2. Now sometimes when name column deleted all my sheet 2 shows N/A. So I need such formula which can automatically re-write my names when they are deleted.

2017-06-07 08:09:07


Here is another around the problem. Instead of

IF(A1=6, B1, C1)

You can write

IF(A1=6, IF(ISBLANK(B1),"",B1), IF(ISBLANK(C1),"",C1))

2017-03-27 12:57:41


THANK YOU SO MUCH. Couldn't find this anywhere. Searched and searched. Fairly simple really.

2016-08-18 10:27:45

Stephen C.

"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."

AND() ignores blank cells, and therefore effectively returns TRUE on a blank cell in the situation where the other arguments to the AND() function happen to return TRUE.

This is an idiosyncrasy in Excel which is good to be aware of, as it can play havoc with logic!

It is not a consistent idiosyncrasy either as NOT() treats a blank cell as FALSE (returning TRUE as you'd expect).

So you can get around the AND() idiosyncrasy by using NOT(NOT()) within an AND() function if the cell might be blank, and your logic depends on excel reading it as false (that's not the most elegant solution, but it does highlight Excel's inconsistency!).

EXCEL IS NUTS! The amount of time I have had wasted by Excel's bizarre idiosyncrasies is colossal.

2016-07-28 16:42:53


hi Allen, thanks for the helpful post.
I have a minor correction to your details.

I believe it's not 100% accurate to say "regardless of what the formula returns, you can use its result in other formulas, and it works fine," and likewise incorrect, "Even if it returns an empty string, it is still treated by other formulas as if it contained zero."

empty strings (and text of any kind, in fact) *in arrays* are "nicely ignored" by aggregate functions such as SUM and MAX/MIN.

first, note I say "ignored" because they're not truly "treated as zero" as you said. if a range of cells contains {1, ="", 3} respectively, you'll note the MIN and PRODUCT of that range are 1, and 3 respectively (not zero they would be if they contained a zero value).

a quick aside is this (aggregate functions tolerating text) only works on values in arrays (like SUM(A1:A3)) because arrays know to ignore non-numeric values. using single-values (like SUM(A1,A2,A3)) that aren't numeric will still cause errors. so to repeat, MIN({1, "", 3}) is 1 but MIN(1, "", 3) is an error.


2015-06-05 05:46:36


Hi Allen & all that have left tips in the comments,
I just wanted to say thanks for giving clear & practical advice that helped me easily solve my issues with this type of problem.

2015-04-25 05:44:07

Willy Vanhaelen

Here is a one line version of the macro:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, [A3]) Is Nothing Then [B7] = [A3]
End Sub

2015-04-25 02:10:38


Thank you all, especially Michael Micky Avidan. =A3&"" simple and works beautifully.

2015-03-31 05:49:08


Thank you, thank you, thank you. I'm setting up a worksheet that just needs to be filled in and I've been trying to figure out how to show the cells as blank if no data is in the adjoining cells!! This has worked perfectly!

2014-10-20 14:05:21


Thank you so much!
I've been trying to solve this pesky issue, and this is the only solution that has worked so far for me

2014-09-11 09:08:14


Hi Micky
Thanks so much for the tip, it works perfectly, even if i remove the 0 from the ops i get a clean cell, which makes presentations really neat.
Great Tip and Many Thanks

2014-09-09 10:10:35

Michael (Micky) Avidan

Try: =IF(A2="","Oops",NETWORKDAYS.INTL(A1,A2,...
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)

2014-09-08 06:19:33


Hi There
I am trying to calculate on (Cell A3) the period of time between date 1 (Cell A1) and date 2 (Cell A2) which so far is a success.

i.e. =NETWORKDAYS.INTL(A1,A2,1,{41640;41733;41736;41764;41785;41876;41998;41999})
where 1 & {data} does not include holidays & weekend on calculation.

What i need is to incorporate the IFBLANK formula so i do not get the weird outcome when there is no date on Cell A2. Is that the right formula to use in this case? is there another way to do it.
Please help.

2014-08-29 13:29:01

Michael (Micky) Avidan

I don't see any problem in using: =A3&""
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)

2014-08-28 12:24:16


I have the following formula:

I want to have it blank if D52 is empty. Can you please show me what that entire formula would look like?

2014-07-10 01:06:11


Thank you so much, very helpful...keep it up.

2014-06-11 19:03:06


Yes I am having weird issue on my tie in workbook that takes a vroom up formula and returns a date from another sheet. However when the cell is empty it gives me the 00-Jan-00 output but I want the summary book to show blank if their is no date yet. So I tried to attach the if is blank formula and I get circular reference error and no change to output with weird date. Help!

2014-04-21 13:12:02

Just Plain Eric

Kris, I have a few comments:

First, when testing multiple cells for blank-ness, you might prefer to use the COUNT function, which returns the number of cells that are filled.
Second, not sure if you meant to do this or not, but you missed C46 in your ISBLANK tests. This could cause your MAX function to return zero when you expect it to return blank.

With these changes, your formula would become:

Also, the reason your formula returns "1/0/1900" is because the cell is formatted as a date. If you change the number formatting to a number format or General, that result will change to a zero, which is how Excel (and every other SS program I've ever had to work with for that matter) treats a blank cell. If that formula is just a direct reference to C36, then C36 can't actually be blank, and C36 is probably picking up a blank from C46 and returning 0 (zero).

2013-04-30 12:29:48


thank you very much, this site is helpful

2013-04-17 19:55:47

Kris McBride

The NA() hint helped but what if I dont want it to return #na?. I have a formula in C36 as follows: =if(and(isblank(C40),isblank(c43),isblank(c49)),"",max(C40,C43,C46,C49)) which returns a blank cell. I later have a separate tab referencing C36 with the same formula referencing different cells that I want C36 included in but because the second formula treats C36 like it has a zero in it when in acutality is it blank the final formula returns the "1/0/1900" date instead of being blank. Obviously I am dealing with dates and these are details sheets compliling to an overview sheet. Hope you can help.

2013-02-05 05:10:59


I had to use semicolons to get the formular to work.

This Site

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

Newest Tips

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.