How to calculate percentage value inside arbitrary range with results between -100% and +100%

2.5k Views Asked by At

Sorry in advance if this is a very simple question and thanks for any help you might have.

I have a value of $3.82$.

I want to have a minimum and maximum difference allowance of say 1. So

min $= 3.32$ max $= 4.32$

I would like the min to be represented as -100% and max to be 100%. Essentially 3.82 would be 0%.

I have another value that is $3.54$. With the above in mind, how do I work out what percentage this number would be in my scale?

I did have a go using this formula but it gives me a scale of 0 to 200. Which isn't want I'm after, which is a scale of -100 to 100. How to calculate percentage of value inside arbitrary range?

Thanks again!

Jim

2

There are 2 best solutions below

2
On BEST ANSWER

It would make more sense to consider this symbolically

If you have min = $x$, max = $y$, then you have a range $y-x$

to calculate where a number $z$ lies on this range calculate

$200 \times (z-x)/(y-x) - 100$

For your example:

$ 200 \times(3.54-3.32 )/(4.32-3.32)-100 = -56$

0
On

Let your value, for which %age is to be calculated, be 'x'.

Let the middle value, in this case, 3.82 be 'y'.

and the minimum and maximum difference allowance, here 1, be 'd'.

Then, the formula to be used would be:

$$ \frac{(x - y)}{d/2} * 100 $$

This gives you the range of -100% to 100%.