# Help on IF statement?

##### Board Regular
=IF(O2>10,40,IF(O2=4,16,IF(O2=5,20,IF(O2=6,24,IF(O2=7,28,IF(O2=8,32,IF(O2=9,36,)))))))

What is happening is that if the O2 is 6 it is returning zero?

4=16
5=20
6=24
7=28
8=32
9=36

10,11,12 = 40

### Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use \$ signs: \$V\$2:\$Z\$99 will always point to V2:Z99, even after copying

#### Andrew Poulsom

##### MrExcel MVP
I couldn't reproduce your problem, but maybe try:

=MIN(O2*4,40)

L

#### Legacy 51064

##### Guest
Andrew has a very nice solution. If you need all of the if statements:

=IF(O2=4,16,IF(O2=5,20,IF(O2=6,24,IF(O2=7,28,IF(O2=8,32,IF(O2=9,36,IF(O2>10,40,0)))))))

Will O2 ever be less than 4?

##### Board Regular
No...But - here mught be the problem: Here is "O"

=(M2-I2)/30

L

#### Legacy 51064

##### Guest
If the product is not a whole number, then the my solution will not help you in its current form.

#### barry houdini

##### MrExcel MVP
Clearly the result of

=(M2-I2)/30

isn't exactly 6

You perhaps need to adjust one of the formulas, either you round the value in O2 to the nearest integer

=ROUND((M2-I2)/30,0)

or perhaps adjust the other formula to cope with values that are not integers

Replies
5
Views
153
Replies
1
Views
90
Replies
10
Views
153
Replies
3
Views
106
Replies
17
Views
545