Return a rating based on a number range

alecto3

New Member
Joined
Mar 26, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi, trying to write a formula that returns one of four text ratings based on what number is displayed in cell D32. Here's what I have : =IF(D32≤34,"Minimal change challenge",IF(AND(D32≥35AND≤50),"Moderate change challenge",IF(AND(D32≥51AND≤75)),"Substantial change challenge",IF(AND(D32≥76),"Significant change challenge"))). Not sure where I'm going wrong, can anyone help?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Excel Formula:
=if(D32<34,"Minimal Change challenge",If(And(D32>35,D32<50),"Moderate Change Challenge",if(And(D32>51,D32<75),Substantial Change Challenge",Significant Change Challenge")))
When you use and AND statement in the IF, you need to specify each statement with a comma between
Also you don't need the last IF, if all the other if's are not ture it defaults to the last one.
Hope that helps.
 
Upvote 0
Thanks for this! Still getting an error - I think it may be to do with how the range is represented. I've tried using the greater-than-or-equal-to symbol and I've tried using your formula (D32>35,D32<50) but neither work :(. Once I get past the first statement it goes wrong.
=IF(D32<34,"Minimal Change challenge") works fine.
But as soon as I add another category an error comes up, i.e.
=IF(D32<34,"Minimal Change challenge"),IF(AND (D32>35,d32<50)"Moderate change challenge")
 
Upvote 0
Here is one idea, but I'm not sure what your thresholds are supposed to be...whether they should be > or >=
MrExcel_20240326.xlsx
DE
3251Substantial Change Challenge
Sheet2
Cell Formulas
RangeFormula
E32E32=XLOOKUP(TRUE,D32>={75,50,35},{"Significant","Substantial","Moderate"},"Minimal")&" Change Challenge"
 
Upvote 0
Thanks for this! Still getting an error - I think it may be to do with how the range is represented. I've tried using the greater-than-or-equal-to symbol and I've tried using your formula (D32>35,D32<50) but neither work :(. Once I get past the first statement it goes wrong.
=IF(D32<34,"Minimal Change challenge") works fine.
But as soon as I add another category an error comes up, i.e.
=IF(D32<34,"Minimal Change challenge"),IF(AND (D32>35,d32<50)"Moderate change challenge")
=IF(D32<34,"Minimal Change challenge",IF(AND(D32>35,D32<50),"Moderate change challenge",""))
You had a Bracket after the first if, instead of a comma, and no comma after the first and statement. See if the above works, also check out KRice's suggestion
 
Upvote 0
Solution
Welcome to the MrExcel board!

A couple of other possible options. The second one is just a slight variation on Kirk's.
I have assumed that the values in col D are whole numbers as your original attempted formula was not trying to allow for values like 34.5

Cell Formulas
RangeFormula
E32:E35E32=CHOOSE(MATCH(D32,{0,35,51,76}),"Minimal","Moderate","Substantial","Significant")&" change challenge"
F32:F35F32=XLOOKUP(D32,{34,50,75},{"Minimal","Moderate","Substantial"},"Significant",1)&" change challenge"
 
Upvote 0
Interesting, Peter. I would have preferred to keep all of the adjectives in a single array or list as you've done with the CHOOSE/MATCH formula, but wasn't sure what the lower bound for the value in D might be. So I ended up using the [if not found] argument in XLOOKUP. But if D<0, then the lower threshold in MATCH needs some attention. I opted for a XLOOKUP(TRUE,D32>=... approach to make the lower threshold definition more explicit and easier to see/revise, but it's not clear to me whether the OP wants D32> or D32>=, and what the realistic lower bound for the D value is. Those details are needed to fine-tune a formula to correctly deal with the thresholds.
 
Upvote 0
But if D<0, then the lower threshold in MATCH needs some attention.
Sure. We don't know what is possible but if negatives are possible, pretty easy to change the lower bound to something that should cope.
eg
Excel Formula:
=CHOOSE(MATCH(D32,{-9E+99,35,51,76}),"Minimal","Moderate","Substantial","Significant")&" change challenge"
 
Upvote 0
=IF(D32<34,"Minimal Change challenge",IF(AND(D32>35,D32<50),"Moderate change challenge",""))
You had a Bracket after the first if, instead of a comma, and no comma after the first and statement. See if the above works, also check out KRice's suggestion
That works!! Thank you for your help, I did have issues with missing commas but eventually got it to reflect one of four different ratings based on the number range. Very happy, thank you for your help!
 
Upvote 1

Forum statistics

Threads
1,215,128
Messages
6,123,204
Members
449,090
Latest member
bes000

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