If problem

proctk

Well-known Member
Joined
Dec 24, 2004
Messages
840
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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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.
 
Upvote 0
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)
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,869
Messages
6,122,012
Members
449,060
Latest member
LinusJE

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

Which adblocker are you using?

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
Back
Top