Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IF ELSE in excel -- check if a cell is null/empty

I am not programming in VBA. This is a simple excel spreadsheet. Essentially, I have a formula the finds the lowest price in a range of cells and returns its respective column title. It works fine. However, some ranges do not have any values at all. So, the cell that populates with the column header displays #N/A in this case.

What I need to do is check whether or not this happens. If the result is #N/A, I want the cell to show "No Values to Reference." I was thinking something along the lines of:

=IF(CELL != NULL, Display_Header, ELSE "No Bids to Reference")

OR

=IF(CELL = NULL, No Bids to Reference", ELSE Display_Header)

I have tried both NULL and #N/A but I am not sure how Excel handles these situations. That is, how Excel handles #N/A returns.

IF(INDEX($D$1:$M$1,MATCH(MIN(D3:M3),D3:M3,0))= "#N/A","No Bids To Reference", INDEX($D$1:$M$1,MATCH(MIN(D3:M3),D3:M3,0)))
like image 375
sherrellbc Avatar asked Jun 12 '13 14:06

sherrellbc


2 Answers

Since you have only one calculation here, you can simply use an IFERROR:

=IFERROR(INDEX($D$1:$M$1,MATCH(MIN(D3:M3),D3:M3,0)),"No Bids To Reference")

The IFERROR checks whether the expression evaluates to an error (it can be #N/A, #VALUE! or #REF!). If true, evaluate the next expression, otherwise return the first expression.

like image 61
Jerry Avatar answered Oct 10 '22 19:10

Jerry


I would CTL+G, Special, and replace the values of all cells with formula errors.

like image 26
Andrew Avatar answered Oct 10 '22 17:10

Andrew