+ Reply to Thread
Results 1 to 12 of 12

Nesting IF Function

Hybrid View

  1. #1
    Registered User
    Join Date
    03-28-2012
    Location
    Union City, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Nesting IF Function

    I am trying to compare two dates in two columns. If there is no date, I want the cell to be blank. If the date is <= to the previous date, I'd like the cell to return a value of "Yes". If the date is greater than the previous date, I'd like the cell to return a value of "No".

    I've tried:
    =IF(ISBLANK(H20),"",(IF(H20>G20,"No","Yes")))
    =IF(COUNT(H20)<>1," ",IF(H20<=G20,"Yes","No"))

    If there is no date entered in the cell, I can get the cell to be blank. However, I've tried interchanging the greater than/less than equal signs and the yes/no in both formulas, but it seems that the cell returns the first condition no matter if the date is less than/greater than the previous date.

    Thank you.

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Nesting IF Function

    Try

    =IF(H20="","",IF(H20<=G20,"Yes","No"))

  3. #3
    Registered User
    Join Date
    03-28-2012
    Location
    Union City, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Nesting IF Function

    I'm still getting "yes" no matter what the date is. Thanks.

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Nesting IF Function

    Hi Neeners36,

    If you are getting first condition every time... check if H20 is blank
    Try below function as an option:-

    =IF(ISBLANK(H20),"",IF(H20<=G20,"Yes","No"))

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  5. #5
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Nesting IF Function

    Hi Neeners36,

    Please upload the sample workbook... thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

  6. #6
    Registered User
    Join Date
    03-28-2012
    Location
    Union City, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Nesting IF Function

    If I use the greater than sign, the second condition is returned:
    =IF(H20="","",IF(H20>G20,"Yes","No")) ... I get "No"
    =IF(H20="","",IF(H20>G20,"No","Yes")) ... I get "Yes"

    If I use the <=, the first condition is returned:
    =IF(H20="","",IF(H20<=G20,"Yes","No")) ... I get "Yes"
    =IF(H20="","",IF(H20<=G20,"No","Yes")) ... I get "No"

    Odd. btw, I can't upload/download on work computer

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Nesting IF Function

    That doesn't tell us much without knowing what is in H20 and G20 for each of those.

    BTW: Is it possible H20 contains " " a space, instead of being ""

    I ask because you said this in post #1
    =IF(COUNT(H20)<>1," ",IF(H20<=G20,"Yes","No"))

    In any event - that formula should be: =IF(COUNT(H20)<>2,"",IF(H20<=G20,"Yes","No"))

  8. #8
    Registered User
    Join Date
    03-28-2012
    Location
    Union City, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Nesting IF Function

    G20 and H20 are dates.
    To test it, I entered 06/01/12 in G20.
    I tried entering dates before and after 06/01/12, and it returned the first condition no matter what.

    It will return a blank cell if there is no value in H20 with =IF(COUNT(H20)<>1," ",IF(H20<=G20,"Yes","No")).
    Using a "2" returns a blank value when there is a date in H20.

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Nesting IF Function

    Sorry, that should have been

    =IF(COUNT(G20:H20)<>2,"",IF(H20<=G20,"Yes","No"))

    You didn't answer my question though. For each of the scenarios you listed in post #6 what were the values in G20 AND H20

  10. #10
    Registered User
    Join Date
    03-28-2012
    Location
    Union City, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Nesting IF Function

    G20 = 06/06/12
    H20 could be a date before or after that date.
    When the date is entered in H20, I want to know if they met the deadline of 06/06/12.
    If they did, I'd like the returning value to say "Yes", but if they didn't the value returned should be "No".
    At the same time, I'd like the value returned to be blank if no date is entered. If it makes it easier, the value returned could also say "No" if no date is entered.
    Thank you.

  11. #11
    Registered User
    Join Date
    03-28-2012
    Location
    Union City, CA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Nesting IF Function

    Geez. All these solutions worked. My problem was the deadline date is in 2013 (automatically populated), so entering the date in 2012 obviously gave me the same result. DUH! Thanks all.

  12. #12
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Nesting IF Function

    Isn't Excel fun? Glad you got it working. Thanks for the 'star tap'.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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