[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# Number Range Formula

Posted on 2012-08-30
Medium Priority
641 Views
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?
0
Question by:turtleman2009
• 4

LVL 27

Expert Comment

ID: 38352807
(A - 20000)/(80000) = (B -300)/(1700)
0

LVL 27

Expert Comment

ID: 38352810
(A - 20000)/(80000) = (B -300)/(1700)
0

LVL 27

Accepted Solution

d-glitch earned 2000 total points
ID: 38352820
What yup are calculating are the equivalent fractions of each range.

35000 is 15/80 = 3/16

B = 300 + (3/16)*1700
0

LVL 27

Expert Comment

ID: 38352825
B = 618.75
0

LVL 5

Expert Comment

ID: 38352839
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!
0

LVL 27

Expert Comment

ID: 38352940
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
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Win a Jar of Candy Corn: A Scientific Approach! I love mathematics. If you love mathematics also, you may enjoy this tip on how to use math to win your own jar of candy corn and to impress your friends. As I said, I love math, but I gu…
This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
###### Suggested Courses
Course of the Month18 days, 6 hours left to enroll

#### 831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.