Scale a range from ($-251$ to $198$) to ($0$ to $100$)?

123 Views Asked by At

I have a scoring system set up, where the worst score possible is $-251$, and the best is $198$.

How can I scale any results, to fit on a $0$ to $100$ scale? (I.e. if the user gets $-251$, I want to show $0$ instead). I found this thread which got me to a formula of:

$y = \frac{-98}{251} \cdot x+ 100$

But, if I plug in $-251$ for $x$, I get $198$, instead of the expected $0$. If my slope is instead $\frac{98}{251}$, the result is $2$ (which is obviously closer to $0$).

What am I missing/misunderstanding?

2

There are 2 best solutions below

3
On BEST ANSWER

You can use $$ y=100 \left(\frac{x+251}{449}\right) $$ Essentially what this does is

  1. shift your original answer up by 251 (so the lowest number gives you your zero)
  2. find the fraction of this out of 449 (your 198 also shifted up 251)
  3. multiple that decimal to get a percent of 100

I'm not sure exactly where yours is coming from, so I'm not sure where you went wrong. But if you graph it, you can see that yours has a negative slope: graph on Desmos

0
On

You must have read various forms of equations of the straight line.
The one that fits the situation to a tee is:

$(y-y_1) = \dfrac{y_2-y_1}{x_2-x_1}\cdot(x-x_1),\;$

Taking $(x_1,y_1), (x_2, y_2)\;\; as\;\; (-251,0)\;\; and\;\; (198,100)$ , we directly get

$y = \dfrac{100}{449}\cdot (x + 251)$