turtleman2009
asked on
Number Range Formula
I am creating an online tool and I understand the concept of what I need but not the exact formula to get me to where I want to be. I have two ranges of numbers the ranges will change but for this example we will use:
low a: 20,000
high a: 100,000
low b: 300
high b: 2000
So I will be given a number that fits inside of the range for "group a" and I need to find its equivalent for "group b" so if I was given the number 35,000 for group a what is the formula to find its counterpart for group b?
low a: 20,000
high a: 100,000
low b: 300
high b: 2000
So I will be given a number that fits inside of the range for "group a" and I need to find its equivalent for "group b" so if I was given the number 35,000 for group a what is the formula to find its counterpart for group b?
(A - 20000)/(80000) = (B -300)/(1700)
(A - 20000)/(80000) = (B -300)/(1700)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
B = 618.75
Hello there,
What's important to calculate here is the range of points in A and B.
The range of points in A is 80,000 - RangeA. For B it is 1700 RangeB
Let's call 'GivenA' the value to be converted into the new value in B called DeriveB.
GivenA - LowA gives you the value you can scale into B. B starts at an offset LowB. So:
(GivenA - LowA)/ RangeA = (DeriveB - LowB)/ RangeB
= (DeriveB - LowB) = ((GivenA - LowA)/ RangeA) * RangeB
= DeriveB = LowB + ((GivenA - LowA)/ RangeA) * RangeB)
Be careful with those brackets!
What's important to calculate here is the range of points in A and B.
The range of points in A is 80,000 - RangeA. For B it is 1700 RangeB
Let's call 'GivenA' the value to be converted into the new value in B called DeriveB.
GivenA - LowA gives you the value you can scale into B. B starts at an offset LowB. So:
(GivenA - LowA)/ RangeA = (DeriveB - LowB)/ RangeB
= (DeriveB - LowB) = ((GivenA - LowA)/ RangeA) * RangeB
= DeriveB = LowB + ((GivenA - LowA)/ RangeA) * RangeB)
Be careful with those brackets!
D-glitch has given you the answer. More generally let
the smallest a be = as
the largest a be = al
the smallest b be = bs
the largest b be = bl
-
let
the number in the a range be = a
the number for which you are looking in the b range be = b
then the equation for b will be
b = (a – as) (bl – bs)/(al – as) + bs
which give the answer to you specific problem 618.75 as d-glitch said
the smallest a be = as
the largest a be = al
the smallest b be = bs
the largest b be = bl
-
let
the number in the a range be = a
the number for which you are looking in the b range be = b
then the equation for b will be
b = (a – as) (bl – bs)/(al – as) + bs
which give the answer to you specific problem 618.75 as d-glitch said