Returning a Blank Value

by Allen Wyatt
(last updated July 20, 2013)

36

The purpose of formulas is to return a value based upon a calculation or comparison. For instance, if you use the formula =1+1, the sum is calculated and the value 2 is returned. There might be times, however, when you want to use a formula and actually return nothing. For instance, you might want to compare a value in a cell to some constant and return a numeric value if they are equal or return nothing if they are different.

The problem is that a formula must, under all circumstances, return something—for it not to do so would go against the very purpose of formulas. There are two ways to approach the problem, and how you do so will affect what you can and cannot do with your results. Consider the following formula:

=IF(A1=0,"",1)

In this instance, the cell containing this will contain a blank value ("") if A1 is 0 or it will contain a numeric value (1) if it is not 0. In either case, something is being returned. You could, however, use the following variation on the formula:

=IF(A1=0,,1)

The only difference here, of course, is that the quote marks have been removed. Interestingly enough, in this case Excel assumes there is a zero between the two consecutive commas, and if A1 is 0, the formula returns a 0. Again, formulas must return something.

The way that Excel's other functions interpret the results of these two formulas is also very interesting. It is instructive to look at how the COUNT, COUNTA, and COUNTBLANK functions interpret the results.

COUNT is used to count the number of cells in a range that contain numeric values. If the cells contain text, or if they are empty, they are ignored. In the case of our formulas, if you use the first formula, COUNT counts the cell if A1 is not zero. If you use the second formula, COUNT will always count the result, since it always returns either 0 or 1, which are both numeric.

COUNTA is used to count the number of cells in a range that contain anything. Regardless of which formula you use, COUNTA will count the cell since formulas always return something. (It can also be argued that COUNTA counts the cell because it contains a formula, but that is probably a fine semantic difference.)

COUNTBLANK examines cells and counts them only if they are blank. In the case of the first formula, COUNTBLANK will count the cell only if A1 is 0. In the case of the second formula, COUNTBLANK will never count the cell, since the formula always returns a 0 or 1 and is therefore never blank.

The above discussion applies if the COUNT, COUNTA, or COUNTBLANK functions are evaluating the results of a series of cells that actually contain formulas. However, if the range includes cells that are really blank (i.e., they contain nothing, not even a formula), then that can affect what is returned by the functions. Blank cells don't affect the results returned by either COUNT or COUNTA, but they do affect the results returned by COUNTBLANK.

What does all this mean? It means that a cell that contains a formula is never really, truly blank—only cells with nothing in them are blank. How the result of the formula is interpreted, however, depends on the Excel functions being used to perform the interpretation. Since different functions interpret formula results differently, you need to be concerned with what you really want to find out about the formula results, and then use the function that will help you best determine that information. If you don't get the result you expect with a particular function, search around—chances are good that Excel has a different function you can use to get the desired results.

That being said, if you have a range of cells that all contain formulas similar to =IF(A1=0,"",1), and you want to delete the formulas in the cells that return a blank value (""), you can quickly do so by following these steps:

  1. Select the range containing the formulas in question.
  2. Press F5. Excel displays the Go To dialog box. (See Figure 1.)
  3. Figure 1. The Go To dialog box.

  4. Click Special. Excel displays the Go To Special dialog box. (See Figure 2.)
  5. Figure 2. The Go To Special dialog box.

  6. Make sure the Formulas radio button is selected.
  7. The only check box that should be selected under Formulas is Text.
  8. Click OK. Excel selects all cells where the formula returned a text value. (This should be all the formulas that returned "".)
  9. Press Delete.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2814) applies to Microsoft Excel 97, 2000, 2002, and 2003.

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

Printing Multiple Envelopes

Need to print envelopes quite often? An easy way to do it is to create an envelope template, as described in this tip.

Discover More

Converting Text to Uppercase in a Macro

Macros are often used to process documents. If part of the processing involves making text selections uppercase, Word ...

Discover More

Preventing Printing

When dealing with determined users, it is virtually impossible to prevent information in your document from being printed. ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (menu)

Understanding Functions

The heart of any formula you put together in Excel is worksheet functions. This tip introduces you to worksheet functions and ...

Discover More

Counting Unique Values with Functions

Using Excel to maintain lists of information is not unusual. When working with the list you may need to determine how many ...

Discover More

Converting to Hexadecimal

Excel allows you to easily convert values from decimal to other numbering systems, such as hexadecimal. This tip explains how ...

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}] in your comment text. You’ll be prompted to upload your image when you submit the comment. 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 4 + 2?

2016-03-02 05:30:32

Michael (Micky) Avidan

Steve,
Try: =IF(Quotes!B15="","",Quotes!B15)
---------------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)
ISRAEL


2016-03-01 09:51:19

Steve

I have a problem, I have 3 sheets that have different names but they all contain the same information, so once I fill in the information on the 1st sheet it copies to the 2nd and 3rd. The formula I used to copy to the other sheets is example: =+Quotes!B15. However if the first sheet Quotes B15 is blank then the other sheet in cell B15 have a 0. How can I have the other sheets cell blank if there is nothing in the 1st sheet cell as in the example above.


2015-11-06 07:57:08

Hugo

A 'blank' is not the same as an empty cell nor is it the same as "".
How to create an empty cell, meaning text from another cell will be displayed over it...


2015-10-20 07:55:10

Danny

Is there a way to have a cell, which contains a formula, be classed as a blank cell?

I currently have an IF formula in the cell next to it to only show a value if the formula in question has displayed a figure. However, the IF Formula thinks that the actual formula is classed as a cell with content.

Is there a way of making this cell 'blank' or a way of making the IF Formula work?


2015-10-11 08:00:03

Michael (Micky) Avidan

@Erhan,
Check out the linked picture:

http://screenpresso.com/=OMVGd

---------------------------
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2016)
ISRAEL


2015-10-10 13:06:17

Wahyu Sumpeno

I have been searching a way to create a true empty cells using formula because I don't want the chart to plot it as zero. Tried to create macro, but if the macro evaluates cell by cell it takes a a long time to run the macro since I have 30,000 cells. This is the best solution since i can create an error cell using NA(), then use the F5 (goto) that select all of those #N/A and erase them (replace with empty cells) at ONCE ! Thank you for the great solution !!


2015-09-29 14:09:57

Dorothy

PLEASE HELP:

I am not sure how to keep a formula going when at the end of my column so that it doesn't keep pasting the same number until data is entered.

My formula is: F9=D10-E10 It is repeated for the 11 rows I have entered data; however, if I pull the formula to down to continue to row 25, the number on row 11 (column F)is just shown repeatedly til row 25

Can't I have the formula there but not show the data until it is entered. Column F is where the data is totaled.
This one does not work:
IF(OR(D10="",E10=""),"",D10-E10)



2015-09-29 08:21:57

erhan

Hi
I have formulated cells on column A.
Some are % values some are blank ("") as a result of the formula.
Column B cells rank according to couln A values.
But, I jus want to have a ranking f the cells where there is a%. Instead it is ranking the total.
In other words if 3 out of 10 cells on column A are blank I want the ranking amongst the other 7.


2015-09-21 12:57:51

Jay

Paula,

Use a "IF" statement. If cell(workbook cell) = "", "", cell(workbook cell)

That means if the cell equals blank, return blank, if not return cell value


2015-09-01 15:56:17

Paula

I have a worksheet that is built by pulling information from several other worksheets. They are all in the same work book.

I need to fix it so that if the cell it is pulling info from is blank, then the cell on the all in compassing worksheet is also blank. Instead it returns a 0. When I use this all in compassing worksheet to make address labels then it leaves a 0 on the label. Help!!!!


2015-08-26 11:47:00

Willy Vanhaelen

@Johan

This formula should do the job: =IF(LEFT(A1,1)="S","",1/3)


2015-08-25 10:43:53

Johan

I have a column (A) that returns the WORD of the applicable weekday (eg. Sunday) this info comes from another cell. (Date function) now I want to return a value (hours) in column (G) based on what day of the week is displayed in column (A).... I would want the value to be 08:00 hours in column G if the cell in column A displays "Monday" - "Friday" BUT when it shows "Saturday" or "Sunday" the value in column G should be "00:00" or even left blank..... PLEASE HELP! BRAIN IS FRIED!


2015-07-29 11:51:11

Joel P

Ok. I hope I am wording this right.

I have a workbook set up where I enter data into the first sheet and the sheets after all have their own functions and auto populate data entered from sheet 1. I.E. Serial numbers change but other information is static so the other sheets auto populate the serial numbers. These serial numbers are made up from 3 cells, a "Prefix", the number (which is the changing data) and a "Suffix". My dillema is that I'm combining the values of the three cells, twice, into one cell value to show "ABC123X and ABC124X". Here's how the formula looks now.

"='INPUT INFO HERE'!G1&'INPUT INFO HERE'!C3&'INPUT INFO HERE'!G2&" and "&'INPUT INFO HERE'!G1&'INPUT INFO HERE'!C4&'INPUT INFO HERE'!G2"

What I need is an "IF='INPUT INFO HERE'!C4=0,""," function inserted so that if the C4 cell has no value, then the cell will only show the value of the one half like so "ABC123X" and not "ABC123X and" or "ABC123X (and the rest of the bad formula"

Any ideas? I'm going to write this once and then cope the cells over and over, inserting the $ before the static values like $G$1 and $G$2.


2015-07-26 08:22:21

ravi

Hi Everyone can someone correct this formula

E26 cell contain = Sunday
G26 cell contain = Blank
Another
G26 cell contain = 9:26

IF(and(E26<>ISBLANK(G26),"Absent",E26<>isnumber(G26),"Working")))


2015-07-14 10:46:44

Luz

Need help. Need to create a formula if and sum

I have 3 different columns need to get the total based on Yes Or No condition

If A=Yes value is $250 if A=No Value is $0

Then If B=Yes value is $300 if B =No value is $0

Total column should be based on answer Yes or NO


2015-06-02 17:08:29

kareem

I need some help with creating a formula. I'm creating a call center monitoring form and 1.) I need all cells add up to 100%. 2.) I need my cells to equal 5 points.


2015-02-05 16:42:51

Anthony

If you are wanting a blank cell returned for visual purposes and not necessarily a trully blank value in the cell you can let the standard formula return a 0 in the cell and then conditionally format the cell to change the color of the text to match the fill background of the cell color when there is a 0 in the cell. This will make it look blank for visual evaluation purposes.


2014-11-14 10:44:01

Michael (Micky) Avidan

@Danny,
For earlier versions than "Excel 2007" try:
=IF(ISERR(A1/A2),"",A1/A2)
For Newer versions try:
=IFERROR(A1/A2,"")
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)
ISRAEL



2014-11-13 06:07:44

Barry

@ Danny

This formula will do as you ask but will display 0 if A1 is 0

=IF(OR(A1="",A2=0),"",A1/A2)

if you want the result to be blank if A1 is 0 then use this formula:

=IF(OR(A1=0,A2=0),"",A1/A2)


2014-11-12 14:08:11

Desmon Flonnory

Hello,
This is my formula.

=(SUM(L13+P13)-(L12+P12))*24.

I would like to return a 0 if there are not values in the targeted cells. Thank you for your help.


2014-11-03 06:06:53

Mohsen

Hi,

I'm trying to use this IF formula.

What i'm trying to say is that if a cell is empty do not have comma, if there is text in it start with "," and then the text after that.

I use the If formula in a CONCATENATE fomula.

Really appriciate your help!


2014-10-27 22:23:25

mao

great tip. thanks for sharing


2014-09-28 13:15:27

joel

how do I hide and display the end product of rank formula i.e in the result cell it will indicate 1.


2014-09-23 08:51:39

Danny

Hi im am really hitting a wall

I have a simple formula that calculates the ratio (=a2/a1). however I would love for it to be blank if there is an error. E.g. if there is nothing in a1 or a2, I would like the cell the be blank and not (#Dive/0!)

Any advice? :)

Thanks


2014-09-04 23:11:53

LW Tan

Hi,
I wonder if anyone can help me with this "blank" cells isuue that I am having. I used "find and replace" to replace cells containing only "X" with blank. After replacing, although the cell is blank, when I view formula bar, it has a " ' " in each cell. As such when I use isblank()to check on each of those cells, it is indictaed as false.
How can I use "find and replace" to truly replace the cell with a blank?

Thanks.


2014-09-04 05:27:19

Barry

@ Laine
This can be solved using an IF function.
Change your formula to: =IF(D9="","",E8+D9)

@ Adrian
The solution is similar to Laine's but requires both cells to be blank (or have a zero length string) for the results cell (the one with the formula in it) to be blank.
Change the formula to: =IF(AND(F5="",G5=""),"",(F5+G5)/2)

Technically the tested cells (D9, F5 or G5) do not need to be blank they could have a formula that results in a blank or a zero length string.


2014-09-03 17:37:38

Adrian

if I have 2 cells that are empty F5 and G5 how can I leave the cell with the formula in blank =(F5+G5)/2


2014-07-07 04:15:12

Laine

This is driving me mad but I suspect it is a simple fix. EG. Cell D8=22.00. D9 is blank. E8=22.00. Formula in E9 is E8+D9. But if D9 is blank, I don't want the formula to display after I copy the formula down the page.


2014-06-23 01:32:15

MORNE

HI I WANT TO COUNT THE CELLS THAT CONTAINS BLANKS AND RETURN WITH THE TOTAL 12''/10''


L343 SW 1 194/014 12''
L343 SW 2 194/014 12''
SW 3 194/014 10''
L343 SW 4 194/014 10''
L390 SW 5 194/014 10''
SW 6 194/014 10''
SW 7 194/014 12''
L419 SW 8 194/014 12''
L419 SW 9 194/014 12''


2013-10-14 19:15:07

Rob

There are two problems with COUNTA - firstly, the Excel documentation says it counts non-blank cells. However, the definition of 'blank' here is different than the definition used by ISBLANK or COUNTBLANK, both of which treat "" as blank. So you get the unexpected result that COUNT(range) may or may not = COUNTA(range) + COUNTBLANK(range).

Secondly, in terms of the various solutions which involves locating 'blank' cells and clearing them in order that COUNTA will give the desired answer, these are not helpful when the 'blank' result is the result of a formula, since this will then clear the formula from the cell.


2013-10-08 20:43:37

Amanda P

Hi there,

In my specific situation, I am using a combo-box to filter data based on the value selected from the drop down. The problem I'm running into is that without being able to return a blank cell into the advanced filter criteria I am not able to undo the filter when selecting the blank cell in the dropdown menu. I'd like to be able to use the combobox to choose numbers 1-3 or to undo the sort. Any suggestions?

This is what my VBA looks like for the combo box so far...something is not working. I added the last bit in an effort to clear the cell, but that doesn't seem correct though it doesn't return an error:

Private Sub ComboBox1_Change()
'runs advanced filter based on combobox value'
Range("C31:DM98").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("C4:DN5"), Unique:=False
ActiveWindow.SmallScroll ToRight:=-86
'specifies if value is zero to clear filter'
For Each cell In [ComboBox1]
If (cell.Value = 0) Then cell.ClearContents

Next
End Sub

THANK YOU IN ADVANCE!!!! No one seems to know the answer.


2013-08-29 14:34:36

Ben

In the case I just mentioned, you can instead return NA() for the formula and then search for Error only. This should work great for me. Thanks for the idea to use Go T


2013-08-29 14:32:16

Ben

I like the idea, unfortunately it only works if your formula will only return numeric values. If your formula can return a numeric or text value, this will also highlight any valid text you want to keep.


2013-08-20 13:27:55

James

thomas - you are a genious... no one else could help


2013-07-31 15:54:52

Thomas Papavasiliou

I use a method where i intentionally create an error value as
=IF(A1=0,22/0,1)
and then with Goto, Special, formulas,errors box checked, I erase the cells containing the error value.


2013-07-31 07:53:23

William Tretiak

I have this formula: =IF(COUNTIF(H2:X2:AB2:AJ2:AM2:AO2:AR2:AZ2:BD2:BP2:BU2:CQ2:CU2:DW2,"Y")=COUNTA(H2:X2:AB2:AJ2:AM2:AO2:AR2:AZ2:BD2:BP2:BU2:CQ2:CU2:DW2),"Y","N") The box this is in returns either a Y or an N depending on the selection in the cells, however it does no return a blank if all the ranged cells are blank.This needs to return a blank only when all cells in those ranges are blank. If even one of the cells has an entry I need it to return that value. Can you help?


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