Calculate a score based on a range of values

628 Views Asked by At

I need to convert values to a score in points. Values can range from 0 to 15000.

What formula should I use to calculate the following?

  • Any value between 0 and 50 should get the maximum score of 1000.
  • Any value equal or greater than 3000 should get the minimum score of 0.
  • A value of 51 should be 999 points.
  • A value of 2999 should be 1 point.

The score should be an integer in the range of 0 to 1000, based on the value. Obviously, multiple different values will produce the same score.

I did some research but I am not even sure how to call what I am searching for and therefore haven't found any useful info so far.

1

There are 1 best solutions below

1
On BEST ANSWER

You could do this: $$s = \lceil 999 - \frac{999}{2949}(v-51) \rceil$$

where the $\lceil \ \rceil$ means you round the result upwards to the next integer. If the result is larger than $1000$, you change it to $1000$, and similarly you replace any score below $0$ by $0$.

For example, $v=50$ gives $s=\lceil 999+\frac{999}{2949}\rceil = 1000$, and $v=51$ gives $s=\lceil 999\rceil = 999 $ where no rounding needed.

On the other end, $v=3000$ gives $s=\lceil 999-\frac{999}{2949}2949\rceil = \lceil 0 \rceil = 0$ exactly, while $v=2999$ gives a score of $s=\lceil 999-\frac{999}{2949}2948\rceil = \lceil 0.338 \rceil = 1$.