+ Reply to Thread
Results 1 to 8 of 8

Combine IF(OR and IF(AND - is this possible?

  1. #1
    Registered User
    Join Date
    05-06-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2010
    Posts
    5

    Combine IF(OR and IF(AND - is this possible?

    Hello, I have an IF(AND and an IF(OR statement that each work individually, but I need to combine them into one function since I have multiple variables.
    These are the functions that work separately:
    =IF(AND(D13="SN",N13>M13),AB13,AC13)
    =IF(OR(D13="GN",D13="GR"),AD13,AE13)

    The N13>M13 only applies if D13="SN"; I also have additional formulas/calculations in AB13, AC13, AD13 and AE13 (I found it easier to put them in those cells rather than having a really complicated nested IF function, but it seems like I'm going back to the complicated route at this point). How do I make this into one function? I'm stumped! Thanks!!

  2. #2
    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,933

    Re: Combine IF(OR and IF(AND - is this possible?

    Hi and welcome to the forum

    maybe something like this>
    =IF(AND(D13="SN",N13>M13),AB13,IF(OR(D13="GN",D13="GR"),AD13,AE13),AC13)
    =
    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

  3. #3
    Registered User
    Join Date
    05-06-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Combine IF(OR and IF(AND - is this possible?

    Quote Originally Posted by FDibbins View Post
    Hi and welcome to the forum

    maybe something like this>
    =IF(AND(D13="SN",N13>M13),AB13,IF(OR(D13="GN",D13="GR"),AD13,AE13),AC13)
    =
    Thanks for the welcome and the reply!
    Arrrrgggh! I put in the above into an empty cell and Excel is telling me (yet again) that I've "entered too many arguments for this function."

  4. #4
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: Combine IF(OR and IF(AND - is this possible?

    Put the And boolean inside the OR brackets or vice versa
    E.g

    =IF(AND(D13="SN",N13>M13,OR(D13="GN",D13="GR")),AB13,AC13)
    Elegant Simplicity............. Not Always

  5. #5
    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,933

    Re: Combine IF(OR and IF(AND - is this possible?

    Andy, there are 4 possible answers AB13, AC13, AD13 and AE13

  6. #6
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Doha, State of Qatar
    MS-Off Ver
    excel 2003, 2007, 2010, 2016
    Posts
    124

    Re: Combine IF(OR and IF(AND - is this possible?

    =IF(AND(D13="SN",N13>M13),IF(AND(D13="SN",N13>M13),AB13,AC13),IF(OR(D13="GN",D13="GR"),AD13,AE13))

    try this its done...!

    enjoy....!
    Regards,
    abdul

  7. #7
    Registered User
    Join Date
    05-06-2013
    Location
    Illinois
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Combine IF(OR and IF(AND - is this possible?

    Quote Originally Posted by abubaniyan View Post
    =IF(AND(D13="SN",N13>M13),IF(AND(D13="SN",N13>M13),AB13,AC13),IF(OR(D13="GN",D13="GR"),AD13,AE13))

    try this its done...!

    enjoy....!
    YESS!!!! This works! Thank you!! I will mark this thread as solved shortly, but can you explain why the red part of the function had to be entered twice? Just want to make sure I understand everything.
    =IF(AND(D13="SN",N13>M13),IF(AND(D13="SN",N13>M13),AB13,AC13),IF(OR(D13="GN",D13="GR"),AD13,AE13))

    Edited to add: Ahhhhh, I get it now. Never mind. I see why. =IF(AND(D13="SN",N13>M13),IF(AND(D13="SN",N13>M13),AB13,AC13) Thank you again!
    Last edited by katro; 05-06-2013 at 03:36 PM.

  8. #8
    Forum Contributor
    Join Date
    12-14-2012
    Location
    Doha, State of Qatar
    MS-Off Ver
    excel 2003, 2007, 2010, 2016
    Posts
    124

    Re: Combine IF(OR and IF(AND - is this possible?

    if has only two outcomes....
    so for combining the same i have to create main condition....
    once you fill the first...you will enter in the sub condition....


    IF(AND(D13="SN",N13>M13),IF(AND(D13="SN",N13>M13),AB13,AC13),IF(OR(D13="GN",D13="GR"),AD13,AE13))

+ 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