+ Reply to Thread
Results 1 to 9 of 9

Multiple IF with AND/OR criteria - what am I doing wrong?

  1. #1
    Registered User
    Join Date
    01-13-2010
    Location
    Oxford
    MS-Off Ver
    Excel 2010
    Posts
    57

    Multiple IF with AND/OR criteria - what am I doing wrong?

    Hi All

    I have what I thought was a simple solution but it's not yielding the results I need and although I should, I can't figure out why

    This if my formula

    =IF(B2>"31/12/2020",IF(OR(F2="Yes",G2="Yes"),"31/03/2021",IF(B2>"01/01/2021",AND(OR(F2="Yes",G2="Yes"),"04/12/2020",B2+E2))))

    What I want is, if B2 is less than 31/12/2020 and if column F or G contains yes then show 31/03/2021 otherwise if B2 is less 01/01/2021 and if column F or G contains yes then show 04/12/2020 otherwise add B2 and E2

    Not sure what I've done wrong but it's only returning FALSE

    Any help would be grand!

    Thanks

    Dan_B

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Multiple IF with AND/OR criteria - what am I doing wrong?

    If the dates are real dates... and not text values that look like dates:

    =IF(B2>31/12/2020,IF(OR(F2="Yes",G2="Yes"),31/3/2021,IF(B2>1/1/2021,AND(OR(F2="Yes",G2="Yes"),4/12/2020,B2+E2))))
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    01-13-2010
    Location
    Oxford
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Multiple IF with AND/OR criteria - what am I doing wrong?

    Hi Glenn

    thanks for the reply but it still comes back false which I'm guessing means I didn't fulfill any of the criteria

    I've attached the test file I'm using to see if that helps any?

    Thank again

    Dan_B
    Attached Files Attached Files

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Multiple IF with AND/OR criteria - what am I doing wrong?

    Hi. I may have been being stoopid.

    =IF(B2 > DATE(2020,12,31),IF(OR(F2="Yes",G2="Yes"),DATE(2021,3,31),IF(AND(B2 < DATE(2021,1,1),OR(F2="Yes",G2="Yes")),DATE(2020,12,4),B2+E2)))

    It looks like the AND was in the wrong place... Sample files always help... but an expected answer helps too. So is this correct??
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-13-2010
    Location
    Oxford
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Multiple IF with AND/OR criteria - what am I doing wrong?

    Howdy - I think it's nearly there except the logic is doing the same as mine in that if the B2 < 01/01/2021 then it results in FALSE instead of checking if B2 < 01/01/2021 then check if there is a YES in F2 or G2 to return 04/12/2020 and if there isn't a YES in either then B2 + E2

    Sorry, my explanations are not very good but basically anything that isn't >01/01/2021 regardless of whether there is a YES in the F or G column = FALSE

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Multiple IF with AND/OR criteria - what am I doing wrong?

    As it is set up in your sheet... what is the expected answer?

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Multiple IF with AND/OR criteria - what am I doing wrong?

    Another go... but head is slowly spinning....

    =IF(AND(B2 > DATE(2020,12,31),OR(F2="Yes",G2="Yes")),DATE(2021,3,31),IF(AND(B2 < DATE(2021,1,1),OR(F2="Yes",G2="Yes")),DATE(2020,12,4),B2+E2))

  8. #8
    Registered User
    Join Date
    01-13-2010
    Location
    Oxford
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: Multiple IF with AND/OR criteria - what am I doing wrong?

    Thank you so much Glenn, this last one worked perfectly!!

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Multiple IF with AND/OR criteria - what am I doing wrong?

    You're welcome and thanks for the rep.

+ 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. [SOLVED] if fUNCTION - returning false? what is wrong with my criteria
    By rayted in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 07-11-2019, 04:13 PM
  2. Replies: 7
    Last Post: 11-05-2018, 08:56 AM
  3. Index, match large with multiple criteria pulling wrong record
    By markclary in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-29-2017, 08:00 AM
  4. Index, match large with multiple criteria pulling wrong record
    By markclary in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-28-2017, 02:33 PM
  5. what is wrong in my code (combine string based on criteria)
    By shiva_raj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2017, 01:55 AM
  6. Replies: 6
    Last Post: 08-19-2015, 07:46 PM
  7. SUMPRODUCT with Multiple Criteria Returns Wrong Value
    By Agimcomas in forum Excel General
    Replies: 3
    Last Post: 05-26-2011, 05: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