Dynamic score within range based on value - excel

I am attempting to score a record based on where it's value falls within a range. I know I can create a lookup table but that would be rather time intensive and was hoping for additional options.
Example:
Lower bound of 0
Upper bound of 90
Record has a score of 67
What I want to do is score that record between 1 - 3 based on where the value of 67 falls within the range of 10 - 90. So in this instance this record would score a 2.25, or the like.
Thank you in advance for your assistnace!

This is a simple linear equation
With 67 in A1, in A2 enter:
=A1*0.025+1
and then apply rounding.
The 0.025 comes from =(3-1)/(90-10)
The above chart shows the mapping of records between 10 and 90 into scores between 1 and 3.

Assuming the score is linear, the following formula should work
=Record/(UpperRange - Lower Range)*2+1
In the example you give, this would be: 67/(90-10)*2+1 and the result would be 2.675

If you want the scores to go from 1 to 3, in 0.25 increments, with a lower bound of 0, and upper of 90, then:
=ROUNDDOWN(SCORE/(90/8),0)*0.25+1
Which gives 2.25

Related

Rank order data

I have the loan dataset below -
Sector
Total Units
Bad units
Bad Rate
Retail Trade
16
5
31%
Construction
500
1100
20%
Healthcare
165
55
33%
Mining
3
2
67%
Utilities
56
19
34%
Other
300
44
15%
How can I create a ranking function to sort this data based on the bad_rate while also accounting for the number of units ?
e.g This is the result when I sort in descending order based on bad_rate
Sector
Total Units
Bad units
Bad Rate
Mining
3
2
67%
Utilities
56
19
34%
Healthcare
165
55
33%
Retail Trade
16
5
31%
Construction
500
1100
20%
Other
300
44
15%
Here, Mining shows up first but I don't really care about this sector as it only has a total of 3 units. I would like construction, other and healthcare to show up on the top as they have more # of total as well as bad units
STEP 1) is easy...
Use SORT("Range","ByColNumber","Order")
Just put it in the top left cell of where you want your sorted data.
=SORT(B3:E8,4,-1):
STEP 2)
Here's the tricky part... you need to decide how to weight the outage.
Here, I found multiplying the Rate% by the Total Unit Rank:
I think this approach gives pretty good results... you just need to play with the formula!
Please let me know what formula you eventually use!
You would need to define sorting criteria, since you don't have a priority based on column, but a combination instead. I would suggest defining a function that weights both columns: Total Units and Bad Rate. Using a weight function would be a good idea, but first, we would need to normalize both columns. For example put the data in a range 0-100, so we can weight each column having similar values. Once you have the data normalized then you can use criteria like this:
w_1 * x + w_2 * y
This is the main idea. Now to put this logic in Excel. We create an additional temporary variable with the previous calculation and name it crit. We Define a user LAMBDA function SORT_BY for calculating crit as follows:
LAMBDA(a,b, wu*a + wbr*b)
and we use MAP to calculate it with the normalized data. For convenience we define another user LAMBDA function to normalize the data: NORM as follows:
LAMBDA(x, 100*(x-MIN(x))/(MAX(x) - MIN(x)))
Note: The above formula ensures a 0-100 range, but because we are going to use weights maybe it is better to use a 1-100 range, so the weight takes effect for the minimum value too. In such case it can be defined as follow:
LAMBDA(x, ( 100*(x-MIN(x)) + (MAX(x)-x) )/(MAX(x)-MIN(x)))
Here is the formula normalizing for 0-100 range:
=LET(wu, 0.6, wbr, 0.8, u, B2:B7, br, D2:D7, SORT_BY, LAMBDA(a,b, wu*a + wbr*b),
NORM, LAMBDA(x, 100*(x-MIN(x))/(MAX(x) - MIN(x))),
crit, MAP(NORM(u), NORM(br), LAMBDA(a,b, SORT_BY(a,b))),
DROP(SORT(HSTACK(A2:D7, crit),5,-1),,-1))
You can customize how to weight each column (via wu for Total Units and wbr for Bad Rates columns). Finally, we present the result removing the sorting criteria (crit) via the DROP function. If you want to show it, then remove this step.
If you put the formula in F2 this would be the output:

Excel IF and or value range

I have a formula that currently works pretty well for the most part. It originally was a scoring factor of 90%-100= 5, and 85% to 89.99% = 4 and 80% to 84.99% = 3 and so on. This is represented using the formula below:
=IF($B10>=90%,5,IF($B10>=85%,4,IF($B10>=80%,3,IF($B10>=75%,2,IF($B10<=74.99%,1)))))
So the new requirement came down as follows:
Range value picture
95 to 100% = 5
85 to 89.99% or 101.1 to 105% = 4
80 to 89.99% or 105.1 to 110% = 3
75 to 79.99% or 110.1 to 115% = 2
Less than 74.9 = 1
So the dilemma I'm in is I have not been able to figure out how to create a range for values 2, 3 and 4 to be either or side for the scoring value to become true. So score value 4 should be the ranges of 85% through 89.99% OR 101.1% through 105% to be true.
Does anyone have any ideas on how to restructure this to include the ranges so that if either range is true it would show the correct scoring values? Thanks in advance for your help.
Instead of nested ifs consider using a table then use a VLOOKUP to find the correct value:
I created this table:
Then I can use this formula to get the proper score:
=VLOOKUP(B10,E:F,2,TRUE)
This method has the advantage of being able to easily expand to accomadate new rules. The only caveat is that your table must be sorted on the first column to get the proper return.

Excel function to choose a value greater than or less that a particular value in cell

I have a data set something like this
Units Price
1 15
100 10
150 9
200 8
50000 7
I need the output as Price with respect to quantity.
Example- If Input value is 90 it should give price as 15
If input is 210 it should give value as 8.
However,sadly I cannot use IF statement.
Thanks in advance.
You can use a combination of INDEX and MATCH
=INDEX(B1:B5,MATCH(lookup_value,A1:A5,1))
This assumes Units are in column A and Price is in column B
Make sure you understand both functions:
INDEX
MATCH - particularly the reason for the ,1) at the end
You can also use VLOOKUP. This is probably a bit easier although INDEX/MATCH is more versatile:-
=VLOOKUP(Lookup_value,$A$2:$B$6,2,TRUE)

Excel IF OR Statement

I am having trouble determining the correct way to calculate a final rank order for four categories. Each of the four metrics make up a higher group. A Top 10 of each category is applied to the respective product to risk analysis.
CURRENT LOGIC - Assignment of 25% max per category.
Columns - Y4
Parts
0.25
25
=IF(L9=1,$Y$4,IF(L9=2,$Y$4*0.9, IF(L9=3,$Y$4*0.8, IF(L9=4,$Y$4*0.7, IF(L9=5,$Y$4*0.6, IF(L9=6,$Y$4*0.5, IF(L9=7,$Y$4*0.4, IF(L9=8,$Y$4*0.3, IF(L9=9,$Y$4*0.2, IF(L9=10,$Y$4*0.1,0))))))))))
DESIRED...
I would like to use a statement to determine three criteria in order to apply a score (1=100, 2=90, 3=80, etc..).
SUM the rank positions of each of the four categories-apply product rank ascending (not including NULL since it's not in the Top 10)
IF a product is identified in more than one metric-apply a significant contribution weight of (*.75),
IF a product has the number 1 rank in any of the four metrics-apply a score of (100).
Data - UPDATED EXAMPLE
(Product) Parts Labor Overhead External Final Score
"XYZ" 3 1 7 7 100
"ABC" NULL 6 NULL 2 100
"LMN" 4 NULL NULL NULL 70
This is way beyond my capability. ANY assistance is appreciated greatly!!!
Jim
I figured this is a good start and I can alter the weight as needed to reflect the reality of the situation.
=AVERAGE(G28:I28)+SUM(G28:I28)*0.25
However, I couldn't figure out how to put a cap on the score of no more than 100 points.
I am still unclear of what exactly you are attempting and if this will work, but how about this simple matrix using an array formula and some conditional formatting.
Array Formula in F2 (make sure to press Ctrl+Shift+Enter when exiting formula edit mode)
=MIN(100,SUM(IF(B2:E2<>"NULL",CHOOSE(B2:E2,100,90,80,70,60,50,40,30,20,10))))
Conditional Formatting defined as shown below.
Red = 100 value where it comes from a 1
Yellow = 100 value where it comes from more than 1 factor, but without a 1.

Value between a range of values

Having this:
Class Min Max
Alfa 0 16.5
Beta 16.5 18.5
Charlie 18.5 25
Delta 25 30
And this:
Value X
35.52600894
26.27816853
29.53159178
29.84528548
26.77130341
25.07792506
19.2850645
42.77156244
29.11485934
29.5010482
19.30982162
I want a cell to have something like an IF statement (it's got a few more values in it, not this small, it has 8 class). An IF statement this long would probably not work (IF limit of 7) and is an ugly way of doing it. I was thinking of using hlookup, but I'm not sure if that's the best bet.
I can also swap the columns within a table, so I could have "Min| Max| Class"
X values are in a column.
Basically: =IF(X>=0 && X<16.5, Alpha, IF(X>=16.5 && X<18.5, Beta, IF(...
I think you mean VLOOKUP and would be much better way to go.
Make a Ranges sheet like this
Min Class
0 Alfa
16.5 Beta
18.5 Charlie
25 Delta
30.5 Unidentified
In your detail sheet use formula "=VLOOKUP(A2,Ranges!A:B,2,TRUE)" [The True is important]
And you get
Value X Class
35.52600894 Unidentified
26.27816853 Delta
29.53159178 Delta
29.84528548 Delta
26.77130341 Delta
25.07792506 Delta
19.2850645 Charlie
42.77156244 Unidentified
29.11485934 Delta
29.5010482 Delta
19.30982162 Charlie
With your Max range named MaxVal and your Class range named Class, please try:
=IF(A2>30,"",INDEX(Class,MATCH(A2,MaxVal)))
(adjust references to suit).
=MATCH() here is using the match_type parameter of 1: “The MATCH function will find the largest value that is less than or equal to value. You should be sure to sort your array in ascending order.
If the match_type parameter is omitted, the MATCH function assumes a match_type of 1.”
Any X value greater than 30 returns a blank ("") but text may be inserted to suit (eg "Unidentified" instead of "").
The formula could be simplified by removing the error trap, if a row were inserted immediately under the labels with Alpha under Class and 0 under Max. Also by removing the condition, in a similar way.
It is not necessary to specify both bounds of each range.
INDEX/MATCH was chosen rather than say VLOOKUP for reasons as given here.
PS For the Greek *alpha*bet α is usually Alpha.
Edit re clarification
The easiest fix for 25 is Delta rather than Charlie may be to deduct a small amount from each Max value, eg change 25 to =25-1/1E100.

Resources