I am trying to figure out a formula that will leave a cell blank if another cell is anything other than an expired date, I have =IF(H4<(NOW()), "Expired",""), however for if H4 cell is blank the results are also expired.
I am trying to figure out a formula that will leave a cell blank if another cell is anything other than an expired date, I have =IF(H4<(NOW()), "Expired",""), however for if H4 cell is blank the results are also expired.
=IF(H4="","",IF(H4<TODAY(),"Expired","")
Hi, welcome to the forum
Another option...
=IF(OR(H4="",H4>=TODAY()),"","expired")
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
Confused, are you saying that you want it to return "expired" if H4 is blank (formula blank) or that the formula does return "expired" when H4 is blank (empty cell, no formula) and you don't want it to?
It looks like John has assumed the first problem, while Ford has assumed the second, so hopefully one of them is right. If not, please try to be clearer with your explanation.
Thank you, this worked great!!
Thank you very much!!
Both of the above worked for what I needed, thank you.
I think I read John's formula incorrectly as =IF(H4="",IF(...![]()
I know it's solved...
my 2¢ without IF
=CHOOSE(OR(ISBLANK(H4),H4<TODAY())+1,"","Expired")
![]()
Sandy, that still leave "expired" is H4 is blank?
Ford,
yes, with these two conditions: H4 = blank OR H4<TODAY()
OR(...) gives 0 or 1 and if 0 +1 = 1, or 1 +1 = 2, so with CHOOSE you have CHOOSE(1 or 2, "", "Expired")
Why +1 ? just because index cannot be 0
Last edited by sandy666; 11-20-2015 at 07:30 PM. Reason: forgot OR
As Jason pointed out Sandy, your formula is not returning the correct result
Right, I misunderstood first post.
for me conditions was: H4 must be clear or h4<today()
sorry about that![]()
Nice use of CHOOSE though, great idea![]()
Thanks, but shame on me because I forgot about real "blank" and empty string "blank"![]()
Jason, based on your idea with LEN()
=CHOOSE(AND(LEN($H4)<>0,$H4<TODAY())+1,"","Expired")
to be clear: expired only if date < today(), the rest is ""
or I misunderstood again?
===
update:working with H4=![]()
Please Login or Register to view this content.
- date < today - (result: Expired)
- date > today - (result: "")
- real blank - (result: "")
- empty string ("") - (result: "")
- text (abc) - (result: "")
- generated error (#DIV/0, #N/A, etc.) - (result: "")
- negative numbers (-2) - (result: "")
Last edited by sandy666; 11-21-2015 at 08:18 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks