+ Reply to Thread
Results 1 to 9 of 9

Need formula to check multiple conditions and return specific value

  1. #1
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Need formula to check multiple conditions and return specific value

    OK, I have a user that needs to check for multiple conditions based on the following:
    Return value of "5" if value of cell 'n3' is < 80% of cell 'P3' OR cell 'N3" is less than 250
    Return value of "4" if value of cell 'n3' is less than 90% or greater than or equal to 80% of cell 'P3' OR cell 'N3" is between 250 and 349
    Return value of "3" if value of cell 'n3' is less than 100% or greater than or equal to 90% of cell 'P3' OR cell 'N3" is between 350 and 449
    Return value of "2" if value of cell 'n3' is less than 110% or greater than or equal to 100% of cell 'P3'
    Return value of "1" if value of cell 'n3' is less than 120% or greater than or equal to 110% of cell 'P3'
    Return value of "0" if value of cell 'n3' is 120% or more of cell 'P3'

    A co-worker came up with the following nested IF statement, and while it does not error out, the formula returns an incorrect value...

    =IF(OR(OR(N3<250,N3=P3),N3<(0.8*P3)),5, IF(OR(OR(N3>=250,N3<=349), OR(N3>=(0.8*P3),N3<(0.9*P3))),4,IF(OR(OR(N3>=350,N3<=449),OR(N3>=(0.9*P3),N3<P3)),3,IF(OR(N3>=P3,N3<(1.1*P3)),2,IF(OR(N3>=(1.1*P3),N3<(1.2*P3)),1,IF(OR(N3>=(1.2*P3)),0,"E"))))))
    Attached Files Attached Files
    Last edited by Phraedrique; 01-14-2011 at 03:44 PM. Reason: Trying to get away from Mathematics notation, while probably muddying the waters more...

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need formula to check multiple conditions and return specific value

    Can you double check on these three lines.....
    Return value of "2" if value of cell 'n3' is 100%< or <= 110% of cell 'P3'
    Return value of "1" if value of cell 'n3' is 110%< or <= 120% of cell 'P3'
    Return value of "2" if value of cell 'n3' is 120%< or more of cell 'P3'


    Last line should be "Return a value of 0?
    Other lines, why N3<110% or N3 < 120% of P3? If it's less than 110%, the second part is redundant. What am I missing? I need to get the rules straight before I can put together an IF statement (the order of the IF's will be cruicial) or come up with a different formula.

    EDIT: Okay, figured out what you were trying to do. Just that last line is all.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need formula to check multiple conditions and return specific value

    How's this?
    =IF(OR(N3<0.8*P3,N3<250),5, IF(OR(AND(N3>0.8*P3,N3<0.9*P3),AND(N3>=250,N3<=349)),4, IF(OR(AND(N3>0.9*P3,N3<1*P3),AND(N3>=350,N3<=449)), 3, IF(AND(N3> 1 * P3, N3< 1.1 * P3), 2, IF(AND(N3> 1.1 *P3, N3<1.2*P3),1, 0)))))
    Does that work?

  4. #4
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Need formula to check multiple conditions and return specific value

    OK, that seems to work quite well. I figured that I needed some sort of 'AND" statement in there, but I was getting cross eyed trying to figure it out.
    Many thanks!
    BTW, how do I mark this as answered?
    Last edited by Phraedrique; 01-14-2011 at 03:38 PM.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need formula to check multiple conditions and return specific value

    Go to original post and click on the EDIT button. Then click on "ADVANCED" and change the prefix. Glad that worked for you.

  6. #6
    Registered User
    Join Date
    05-14-2009
    Location
    PA
    MS-Off Ver
    Excel 2007
    Posts
    50

    Re: Need formula to check multiple conditions and return specific value

    thanks! Got it marked as solved.

  7. #7
    Registered User
    Join Date
    11-06-2014
    Location
    NYC, USA
    MS-Off Ver
    Excel 2003, 2010, 2013
    Posts
    2

    Re: Need formula to check multiple conditions and return specific value

    Hi,

    I am currently trying to run the following If statement formula:

    =IF(G21<90%,"6%",IF(G21>=90%<=110%,"8%",IF(G21>=110%<=120%,"10%",IF(G21>120%,"12%",""))))

    The answer I am getting is a blank field when G21 field = 103.15%. It should be returning an 8% value. What am I missing here? I have tried playing with the AND/OR inside the formula and it returns a value of "#value"


    Steve

  8. #8
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Need formula to check multiple conditions and return specific value

    =IF(G21<90%,6%,IF(G21<=110%,8%,IF(G21<=120%,10%,IF(G21>120%,12%,""))))
    Try this, you don't need all the >90<110 because you've already done < 90
    and for future reference, for AND, it would be like this
    =AND(G21>90%, G21<= 110%)
    Hope that helps.

  9. #9
    Registered User
    Join Date
    11-06-2014
    Location
    NYC, USA
    MS-Off Ver
    Excel 2003, 2010, 2013
    Posts
    2

    Re: Need formula to check multiple conditions and return specific value

    YES!!! Awesome, It's working well, thank you very much. I knew it was something simple within the structure of the string.

+ 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