IF and AND functions combined for several ranges

Pickle Lily

New Member
Joined
Feb 28, 2018
Messages
1
I would like to write a formula that assigns a number to a cell value based on a range of numbers. For example, I have a column that calculates 'risk percentage', which I then need to assign to a 'risk ranking' as per the table below:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Risk Ranking[/TD]
[TD]Percentage Range[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]<10%[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]10-20%[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]20-40%[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]40-60%[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]>60%[/TD]
[/TR]
</tbody>[/TABLE]


I have written the following formula: =IF(AND(G22>P13,G22<=Q13),O13,R13), where:

G22 = test value (e.g. risk percentage)
P13 = bottom of percentage range (e.g. 0%)
Q13 = top of percentage range (e.g. 10%)
O13 = result if true (e.g. risk ranking)
R13 = result if false (e.g. -)

I have clumsily spread this out over five columns - one for each percentage range, but is there a way to combine this into one formula / cell?

Many thanks,
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Swap the order slightly and you can use a VLOOKUP:


Book1
ABCDE
1Percentage Lower BoundRisk RankingTest ValueRisk
20%115%2
310%2
420%3
540%4
660%5
Sheet1
Cell Formulas
RangeFormula
E2=VLOOKUP($D2,$A$2:$B$6,2,TRUE)


WBD
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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