Nested If Formula - Please Help!!!

Zedrick13

Board Regular
Joined
Sep 8, 2018
Messages
100
How do I write the formula for a nested if function if the 3rd condition I want to write is ...,IF(B2=""n"No data"))) which means ...IF(B2 is blank, then show "No data").

My idea for the formula is like this: =IF($A$2<=B2,"Valid",IF($A$2>B2,"Expired",IF(B2="","No data")))

And, the table should look like this:
Date Today_Expiration Date_Status
13/09/18__20/01/2019_(Status - Valid,Expired,No data)
13/09/18__12/09/2018_(Status)
13/09/18__ _(Status)

The BLANK value is intentional. I want the formula to put "No data" in C3 for the status if B2 is blank.

Thanks!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I think your first 2 conditions will cover everything .... A2 is either <= B2 or it is > B2 .... if you want to check for B2 being blank then surely it needs to be the first condition ... or have I missed something ?
 
Upvote 0
You can use =IF(ISBLANK(B2),"No data").
If B2 contains a formula, which returns FALSE for ISBLANK, then you can use =IF(COUNTBLANK(B2)>0, "No data"). COUNTBLANK ignores formulas.

But as WaterGypsy says that condition should be first. No point in evaluating the other conditions if B2 is blank.
 
Upvote 0
Thanks, sparky2205. You're a genius.


You can use =IF(ISBLANK(B2),"No data").
If B2 contains a formula, which returns FALSE for ISBLANK, then you can use =IF(COUNTBLANK(B2)>0, "No data"). COUNTBLANK ignores formulas.

But as WaterGypsy says that condition should be first. No point in evaluating the other conditions if B2 is blank.
 
Upvote 0
Can you please help me also with coming up with a formula combining IF and VLOOKUP. I want to use IF to combining a criteria that if VLOOKUP doesn't return a match from the table array, it shows ""(blank) on the cell containing the formula. But, if VLOOKUP returns a result, it shows the match in the cell containing the formula. It's like this:

FORMULA: =IF(No match,"",IF(B2<>"",VLOOKUP(B2,Sheet2!$A$2:$B$5,2,FALSE)))

NOTE: I just made up "No match" in the formula above as an illustration. That's the part I need help with, I guess.

Then, the sheet should look like this with the formula on the second column of Sheet 1:

Sheet1
[TABLE="width: 209"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Company[/TD]
[TD]Contact Person[/TD]
[/TR]
[TR]
[TD]Company A[/TD]
[TD] Hannah[/TD]
[/TR]
[TR]
[TD]Company B[/TD]
[TD] Robert[/TD]
[/TR]
[TR]
[TD]Company C[/TD]
[TD] David[/TD]
[/TR]
[TR]
[TD]Company E[/TD]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]

Sheet 2
[TABLE="width: 209"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]Company[/TD]
[TD]Contact Person[/TD]
[/TR]
[TR]
[TD]Company A[/TD]
[TD] Hannah[/TD]
[/TR]
[TR]
[TD]Company B[/TD]
[TD] Robert[/TD]
[/TR]
[TR]
[TD]Company C[/TD]
[TD] David[/TD]
[/TR]
[TR]
[TD]Company D[/TD]
[TD] Larry[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
You could try using
Rich (BB code):
=IFERROR(VLOOKUP(a1,b1:E10,2,0),"")
Change part in red to your VLOOKUP arguments
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,593
Members
452,654
Latest member
mememe101

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top