# Help on IF statement?

#### scobad

##### 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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I couldn't reproduce your problem, but maybe try:

=MIN(O2*4,40)

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?

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

=(M2-I2)/30

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

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
2
Views
155
Replies
10
Views
748
Replies
4
Views
171
Replies
10
Views
358
Replies
2
Views
172

Threads
1,214,772
Messages
6,121,459
Members
449,033
Latest member
Kcolwell16

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back