+ Reply to Thread
Results 1 to 14 of 14

IF AND and an OR nested together?

  1. #1
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    270

    IF AND and an OR nested together?

    Hello All
    I am pretty sure this is possible, but cant quite get my formula to behave how I am expecting

    Towards the end of the very long formula in AA43 I would expect the total of the conditions being added to equate to 8 and not 7 as returned. I am certain it is how I have my "sub" formula at the end of the long formula.... IF(AND(OR(X43="Y",AB43="N"),X43="N",AB43>0),1,0)

    I am looking to return a 1 if the either of these 2 conditions are met in the sub formula:

    If V43 =Y AND Z43 = N then return a 1 OR if V43=N AND X43>0 then return a 1

    Can someone tell me where I went wrong?

    Thanks so much
    Attached Files Attached Files

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF AND and an OR nested together?

    well what you described in this section
    If V43 =Y AND Z43 = N then return a 1 OR if V43=N AND X43>0 then return a 1
    makes me think this is how that part should look...
    =IF(OR(AND(V43="y",Z43="n"),AND(V43="n",X43 > 0)),1,0)
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    270

    Re: IF AND and an OR nested together?

    Thanks so much Sambo Kid. I dont think I explained myself well enough. The formula you graciously provided is actually adding 2 instead of 1 as I would expect
    and I am sure it is because I am not getting across what I am looking for so please accept my apology

    If either one of the conditions exist, I wish to add a 1 to the formula:

    If V43 =Y AND Z43 = N add 1
    OR
    V43=N AND X43>0 add 1

    Any ideas?

    Thanks again

  4. #4
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF AND and an OR nested together?

    well if I do that as a stand alone formula in your sheet it returns 1, not 2.
    if I substitute that portion into your formula to replace this...
    IF(AND(OR(V43="Y",Z43="N"),V43="N",Z43 > 0),1,0)
    with this...
    IF(OR(AND(V43="y",Z43="n"),AND(V43="n",X43 > 0)),1,0)
    and leave the rest alone it returns 8 which is what you posted in your original post as what you want the result to be.

  5. #5
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    270

    Re: IF AND and an OR nested together?

    Gotcha ! Thanks again !

  6. #6
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF AND and an OR nested together?

    thank you for the rep!

  7. #7
    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
    52,929

    Re: IF AND and an OR nested together?

    The bolded part doesnt look right?
    =SUM(IF(
    OR(S43="N",S43="N/A"),1,0)+IF(
    OR(T43="N",T43="N/A"),1,0))+IF(
    OR(U43="N",U43="N/A"),1,0)+IF(
    OR(V43="y",V43="N/A",V43="N"),1,0)+IF(
    OR(W43>0,),1,0)+IF(
    OR(X43>0,X43="N/A",V43="N"),1,0)+IF(
    OR(Y43>0,Y43="N/A",V43="N"),1,0)+IF(AND(
    OR(V43="Y",Z43="N"),V43="N",Z43>0),1,0)+IF(AF43="N",1,0)
    You are testing for V43 = both Y and N?
    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

  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
    52,929

    Re: IF AND and an OR nested together?

    If the answer in AA43, then maybe this shorter version...
    =COUNT(
    OR(S43="N",S43="N/A"),
    OR(T43="N",T43="N/A"),
    OR(U43="N",U43="N/A"),
    OR(V43="y",V43="N/A",V43="N"),
    W43>0,
    OR(X43>0,X43="N/A",V43="N"),
    OR(Y43>0,Y43="N/A",V43="N"),
    OR(V43="Y",Z43="N",V43="N",Z43>0),
    AF43="N")

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: IF AND and an OR nested together?

    Ford,
    OR(V43="Y",Z43="N"),V43="N",Z43>0),1,0)+IF(AF43="N",1,0)
    You are testing for V43 = both Y and N?
    That is the part I made the recommendation to change.
    But I didn't read it enough to parse out a shorter more efficient version as you did in post 8.

  10. #10
    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
    52,929

    Re: IF AND and an OR nested together?

    Sambo, I kinda figured you had, but that is a pretty long, involved formula, and I was working through it while you posted

  11. #11
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    270

    Re: IF AND and an OR nested together?

    Thank you both FDibbins and Sambo Kid for spending time on my formula.
    I sorta lost you Mr Dibbins..Are you suggesting to replace the formula I have in AA43 with the formula you wrote? Yes, I agree it is LONG ha ha , but that is a reflection of my limited abilities with Excel
    Yes, I am basically testing for a Y or N in V43
    Thank you again

  12. #12
    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
    52,929

    Re: IF AND and an OR nested together?

    Yes, that is what Im suggesting. However, if V43 can only be Y or N, you only need 1 test, if it is Y, then by default it cannot be N (and vise versa)
    So you need to sort that part out 1st

  13. #13
    Forum Contributor
    Join Date
    01-28-2013
    Location
    Spencerport, NY
    MS-Off Ver
    Excel 2016
    Posts
    270

    Re: IF AND and an OR nested together?

    Makes sense ! Thanks again

  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
    52,929

    Re: IF AND and an OR nested together?

    Happy to help and thanks for the feedback

+ 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. Help with a nested, nested, nested formula
    By duanrd2 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-09-2017, 04:43 PM
  2. [SOLVED] Nested vlookup or nested IFAND function?
    By jeptik in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-11-2017, 02:27 AM
  3. Easier Way To Decipher Nested Nested IF's
    By Vladamir in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2015, 03:37 PM
  4. [SOLVED] Nested Sumif's or how to sum data based on nested criteria
    By dlietz in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-07-2014, 11:36 AM
  5. How to reduces Nested IF code(144 Nested IF) to achive same functionality
    By jobseeker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2014, 09:45 AM
  6. Replies: 0
    Last Post: 10-01-2012, 05:54 AM
  7. help on a nested countif/nested if formula
    By vickiemc in forum Excel General
    Replies: 2
    Last Post: 08-13-2008, 08:29 AM

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