+ Reply to Thread
Results 1 to 19 of 19

Formula with 3 ifs

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    Chicagi, IL
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question Formula with 3 ifs

    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.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,983

    Re: Formula with 3 ifs

    =IF(H4="","",IF(H4<TODAY(),"Expired","")

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Formula with 3 ifs

    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

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula with 3 ifs

    Quote Originally Posted by julieabrell View Post
    however for if H4 cell is blank the results are also expired.
    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.

  5. #5
    Registered User
    Join Date
    11-21-2013
    Location
    Chicagi, IL
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Formula with 3 ifs

    Thank you, this worked great!!

  6. #6
    Registered User
    Join Date
    11-21-2013
    Location
    Chicagi, IL
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Formula with 3 ifs

    Thank you very much!!

  7. #7
    Registered User
    Join Date
    11-21-2013
    Location
    Chicagi, IL
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Formula with 3 ifs

    Both of the above worked for what I needed, thank you.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Formula with 3 ifs

    Quote Originally Posted by jason.b75 View Post
    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.
    Actually, we are both doing teh same thing, just in a different way

  9. #9
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula with 3 ifs

    I think I read John's formula incorrectly as =IF(H4="",IF(...

  10. #10
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Formula with 3 ifs

    I know it's solved...

    my 2¢ without IF

    =CHOOSE(OR(ISBLANK(H4),H4<TODAY())+1,"","Expired")

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Formula with 3 ifs

    Sandy, that still leave "expired" is H4 is blank?

  12. #12
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Formula with 3 ifs

    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

  13. #13
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula with 3 ifs

    Quote Originally Posted by sandy666 View Post
    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
    But Ford was pointing out that your formula doesn't give the correct result, compare the results of your formula to the other suggestions when H4 is empty, or contains =""

    Quote Originally Posted by sandy666 View Post
    my 2¢ without IF
    How about this

    =TEXT(N(H4)*(H4<TODAY()),"\expir\e\d;;;")

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Formula with 3 ifs

    As Jason pointed out Sandy, your formula is not returning the correct result

  15. #15
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Formula with 3 ifs

    Right, I misunderstood first post.
    for me conditions was: H4 must be clear or h4<today()
    sorry about that

  16. #16
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,050

    Re: Formula with 3 ifs

    Nice use of CHOOSE though, great idea

  17. #17
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Formula with 3 ifs

    Thanks, but shame on me because I forgot about real "blank" and empty string "blank"

  18. #18
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Formula with 3 ifs

    Quote Originally Posted by sandy666 View Post
    Thanks, but shame on me because I forgot about real "blank" and empty string "blank"
    If you used LEN(H4)=0 or H4<>"" instead of ISBLANK(H4) then it would catch both.

  19. #19
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Formula with 3 ifs

    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:
    Please Login or Register  to view this content.
    working with H4=
    • 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.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 11
    Last Post: 06-06-2014, 03:34 PM
  2. how to hide formula in formula box, view lookup result in formula box?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-14-2013, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1