# If problem

#### proctk

##### Well-known Member
Hi below is an if statement that I cnnot get to work for some reason.

the value returned from C71/C70 will be a decimal value.

that way it is know it only retuns 1 or 0

=IF(C71/C70>=1,"1",IF(C71/C70>=1.15,"2",IF(C71/C70>=1.3,3,IF
(C71/C70>="1.45",4,0))))

### Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

#### Norie

##### Well-known Member
What's in C71 and C70?

What's the logic behind the formula?

Note that if the calculation is >=1 then the formula will immediately stop on the first If and the other parts of it won't get evaluated.

#### proctk

##### Well-known Member
c71 = 20 and c70 = 12

#### will_simpson

##### New Member
As Norie said, its the order of the formula.

If you want the answer to be "4" then reverse the order of the checks.

=IF(C71/C70>="1.45",4,IF(C71/C70>=1.3,3IF(C71/C70>=1.15,"2",IF
(C71/C70>=1,"1",0))))

You are also aware thatyou are returning a text value for 1 and 2 and numeric 0,3 and 4s?

The formula above will give
<0 >> 0 (numeric)
0-0.999999999999999 >> 0 (numeric)
1-1.149999999999999 >> 1 (text)
1.15-1.299999999999 >> 2 (text)
1.3-1.4499999999999 >> 3 (numeric)
1.45 and above >> 5 (numeric)

#### will_simpson

##### New Member
Also, try using a vlookup, set your lookup range in 2 columns.

In the first column, the values over which you want to return a different result and then in the second column what yuo want to return, making sure the values in the first column are in ascending order.

Then use =vlookup(C71/C70,look_up_range,2,1) the 1 at the end means the the lookup will look for the next highest match and give you the effect of >= in the if.

Replies
2
Views
100
Replies
3
Views
313
Replies
4
Views
234
Replies
3
Views
256
Replies
1
Views
324

1,136,613
Messages
5,676,813
Members
419,652
Latest member
jjakub33

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

### Which adblocker are you using?

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

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