Help with nested if statements in Excel

Computing and PC help and advice, programming, games, digital audio, mobile phones and electronic miscellanea.

Announcements Posted on
Sign in to Reply
  1. mackemforever's Avatar
    • Overlord in Training
    • Posts: 2,332
    Help with nested if statements in Excel
    Just a quick message to see if anybody can help me.

    I never use excel but am just trying to put together a small spreadsheet to save me some time with a few tasks but I need a bit of help with one of the functions.

    Essentially I have a cell that will have a calculated value in it and I need this value to drive another cell based on what it is.

    So, lets say that the calculated value is in o2 and I want the new value to be in o3 I want something along the lines of the following:

    If o2 is greater than 50 then o3 displays 2, but if o2 is greater than 70 then o3 displays 3, but if o2 is greater than 100 then o3 displays 4, and so on.

    I thought it would be something like this:

    =IF(O2>50,2,IF(O2>70,3,IF(O2>100 ,4)))

    but it simply displays the value of 2 no matter how far above 50 the value in o2 is.

    Can somebody please tell me how the function should be written?

    Thanks.
  2. Repressor's Avatar
    • Exalted and Worshipped Member
    • Posts: 1,341
    Re: Help with nested if statements in Excel
    The answer lies in that Excel sees the first condition first and as 70 and 100 both lie >50, it will only trigger the first condition, hence giving you 2 as an output.

    As for fixing it, put the conditions the other way around. =IF(O2>100,4,IF(O2>70,3,IF(O2>50 ,2)))
    Last edited by Repressor; 18-05-2012 at 02:20.
Sign in to Reply
Share this discussion:  
Article updates
Moderators

We have a brilliant team of more than 60 volunteers looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Reputation gems:
The Reputation gems seen here indicate how well reputed the user is, red gem indicate negative reputation and green indicates a good rep.
Post rating score:
These scores show if a post has been positively or negatively rated by our members.