Excel formula if number between two values return different values

pnr8uk

New Member
Joined
Oct 6, 2018
Messages
19
Hi All

Got myself really stuck with something I should know better.

I have values in column D of my spreadsheet which will range from 2 to 11

I want to write a formula to return a value in column E along the following lines

When Col D cell 3 <= 3.5 then 1
When Col D cell 3 >= 3.6 Or D3 <= 7.4 then 0.6
When Col D cell 3 <= 7.5 or D3 <= 11 then 0.4
I thought it would be simply
IF(AND(D3<=3.5,1,D3>=3.6,D3<=7.4,0.6,D3<=7.5,D3<=11,0.4))

eg: (and values between)
D E
3.5 1
3.6 0.6
7.5 0.4

Any ideas or help greatly appreciated
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I think you made a mistake here:
When Col D cell 3 <= 7.5 or D3 <= 11 then 0.4
I believe you mean:
When Col D cell 3 >= 7.5 or D3 <= 11 then 0.4

You don't need ANDs if you work up or down in order, since in a nested IF, it will stop at the first true clause it finds.
So try:
Code:
=IF(D3<=3.5,1,IF(D3<=7.4,0.6,IF(D3<=11,0.4,"not found")))
You dodn't say what to return in greater than 11, so I have it returning "not found". You can change that part to whatever you like.
 
Upvote 0
I think you made a mistake here:

I believe you mean:
When Col D cell 3 >= 7.5 or D3 <= 11 then 0.4

You don't need ANDs if you work up or down in order, since in a nested IF, it will stop at the first true clause it finds.
So try:
Code:
=IF(D3<=3.5,1,IF(D3<=7.4,0.6,IF(D3<=11,0.4,"not found")))
You dodn't say what to return in greater than 11, so I have it returning "not found". You can change that part to whatever you like.

Thank you so much for this...
That was surprisingly easy, I have made heavy weather of this so many times before.
The column will never be over 11 but this is great thank you so much.
P
 
Upvote 0
You are welcome.
Also take a look at Aladin's solution. It is another way of doing this in a little more concise manner.
 
Upvote 0

Forum statistics

Threads
1,223,703
Messages
6,173,972
Members
452,540
Latest member
haasro02

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