You are Here: Home

# Help with nested if statements in Excel Tweet

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

Announcements Posted on
1. 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. 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.
Useful resources

## Articles:

The Student Room Tech WikiTech Forum Guidelines

## Groups associated with this forum:

View associated groups