Share via

Nested IF Statements

Anonymous
2021-11-18T16:03:13+00:00

Hello,

I have a set of numbers in excel that range anywhere from 1 to 90 and I am trying to divide the numbers into buckets. I tried using the nested IF statement but I don't get the desired results instead I only get blank values, what could be causing this? Is there something wrong with my formula?

=IF(1<=O7<=10,"A",IF(10<O7<=30,"B",IF(30<O7<=50,"C",IF(50<O7<=70,"D",IF(70<O7<=90,"E"," ")))))

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Ashish Mathur 101.8K Reputation points Volunteer Moderator
    2021-11-19T23:22:39+00:00

    Hi,

    In range A2:A6, type 1,10,30,50,70. In range B2:B6, type A,B,C,D,E. In cell P7, enter this formula

    =vlookup(O7,$A$2:$B$6,2,1)

    Hope this helps.

    Was this answer helpful?

    0 comments No comments

Answer accepted by question author

  1. Anonymous
    2021-11-19T23:09:28+00:00

    The function "Lookup" might be an option:

    Was this answer helpful?

    0 comments No comments

Answer accepted by question author

  1. Rich~M 20,370 Reputation points Volunteer Moderator
    2021-11-18T16:29:21+00:00

    Here is the formula adjusted for your cell O7:

    =IF(AND(O7>=1,O7<10),"A",IF(AND(O7>=10,O7<30),"B",IF(AND(O7>=30,O7<50),"C",IF(AND(O7>=50,O7<70),"D",IF(AND(O7>=70,O7<=90),"E"," ")))))

    Rich~M

    Was this answer helpful?

    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Rich~M 20,370 Reputation points Volunteer Moderator
    2021-11-18T16:26:31+00:00

    Hi BobRafat. I am an Excel user like you and will be glad to help.

    There is a problem with the logical tests in your formula because they do not refer to a specific cell. You must also use an imbedded formula to evaluate 2 criteria as in more than and less than. The following formula will do what you are looking for.

    =IF(AND(A2>=1,A2<10),"A",IF(AND(A2>=10,A2<30),"B",IF(AND(A2>=30,A2<50),"C",IF(AND(A2>=50,A2<70),"D",IF(AND(A2>=70,A2<=90),"E"," ")))))

    Adjust it according to your spreadsheet for the correct column where your 1-90 numbers are located. I also set it to start the new categories at 1, 10, 30, 50, and 70 respectively. Adjust as necessary. I wasn't sure whether you wanted these numbers in the higher or lower category because your criteria above overlapped.

    Reply if you have additional questions or information. Please mark this reply as answered if this solves your question.

    Rich~M

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2021-11-18T16:10:59+00:00

    Hi BobRafat,

    In Excel formula, 1<=O7<=10 is not a correct logic statement.

    You should use AND function to combine these 2 logic.

    So for instance:

    =IF(AND(O7>=1,O7<=10),1,0)

    Regards,

    Alex Chen

    Was this answer helpful?

    0 comments No comments