Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

This then that formula

0

How can I change a range like 80-85 will equal a score. 

So if you get 80%-85% you get a score of 4

I don't know how to create this

Answer
Discuss

Answers

0

You would do that using INDEX//MATCH.

=INDEX({1,2,3,4,5,6},MATCH(A1,{0,20,40,60,80,100,1000},1))

In this example, the value to be graded is in A1. The INDEX is {1,2,3,4,5,6}.  In its place you could have a vertical sheet range, like B1:B5 and, of course, these cells could contain anything, including text, and not necessarily in any particular sequence. You could use an array like {"perfect","very good","good","almost good","not good enough"}.

The MATCH function returns a number from the second array, above it's {0,20,40,60,80,100,1000}. Note the curly braces which signify an array but pay attention to the final 1 because that specifies the nature of the match. There are three choices: -1, 0 and 1. 0 (zero) requires an exact match. -1 will find a number that is not larger than look-up in an array that is sorted descending. Finally, the one we use above, 1 is finding a number that is not smaller than A1 in an array that's sorted in ascending order.

Accordingly, any number larger than 0 but smaller than 2 will be classified as "1". A number below 0 will result in an error as will any number from 1000 and up (you can increase the final integer to 10^10 if that's an issue. 20 will be the lowest number to return a 2.

You can play with the MATCH function until it does what you want. You might set the limit at 19.99 or 20.0001 or use a descending sort with -1 as match type. These are the things to watch out for.

  1. Lowest number (that's why my array starts from 0)
  2. Highest number (that's why my array extends beyond 100)
  3. Exact matching number (that's why I chose type 1)

If these three come out correcty, so will all other variations.

Discuss

Discussion

So I am creating a golf scorecard. If an agent hits a kpi between 95-100 they get a ace which should equal one. I have one spread sheet with the KPI, and I want it to read it and if they get a 96 it will appear as a 1 on the scorecard spreadsheet. 
keverhart Jan 28, '21 at 8:00 pm
Using INDEX/MATCH this formula should do the job: =INDEX({0,1},MATCH(A1,{0,95},1)). However, your requirement may be even less demanding. Try =IF(A1>=95,1,0).
Variatus (rep: 4889) Jan 28, '21 at 8:24 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login