How can I find a value between a range, when percentage is giving? I have a problem where I need to find a value (i.e. x) between the range 80 and 200.
The value of x will depend on a giving percentage value. For example, if the percentage is 75 %, then x should be a value that is closer but not exceeding 200 "Well unless the percentage is over 100 %." And if the giving percentage is 20, then x should be closer but not less than 80.
So when the percentage is 100 % then x is 200. And when the percentage is 0 % then x is 80.
What algorithm could I use to find a value of x?
I tried to do something like this


*

*Convert the percent into decimal (Y)

*(Y * min) / max


But that gives me a number that is less than the min.
Any ideas?
 A: I think you want the weighted average. If the percentage of the way from $80$ to $200$ is $p$ then the number you're looking for is
$$
200p + 80(1-p).
$$
You can see that this gives the right answer when $p=1$ or $0$ or $1/2$.
The formula even makes sense when $p > 1$ ("more than $100\%$") or less than $0$.
A: You just need a order-preserving linear map from the interval $[0,100]$ to $[80,200]$. Generally, the order-preserving map $f:[a,b]\to[c,d]$ is given by
$$f(x) = c + \tfrac{x-a}{b-a}\cdot(d-c)$$
So your map is $$f(x) =\underbrace{80}_{\textrm{start}} +\underbrace{\tfrac{x}{100}}_{\textrm{fraction of the way}}\cdot \underbrace{120}_{\textrm{full length}} = 80 + 1.2x$$
A: The only sense I can make of this question is you want $f:[0,100] \to [80,200]$ so that $f(0) = 80$, $f(100) = 200$ and that: $f(t)$ is proportionally between $f(0)$ and $f(100)$ as $t$ is proportional between $0$ and $100$.
That last garbled weird bit, can be translated into math as:
$\frac {f(t) - f(0)}{f(100) - f(0)} = \frac t{100}$
or $f(t) = t*[f(100) - f(0)] + f(0)$
Which can be thought of as:  $f(0) = 80$ is the starting point.  $f(100)=200$ is the ending point.  $f(100) - f(0)=120$ is the total distance.  $t*[f(100) - f(0)]=t*120$ is the net distance done.  And $f(t) = t*[f(100) - f(0)] + f(0)= t*120 + 80$ is the total distance done.
So $f(t\%) = t\%[200-80] + 80 = t\%*120 + 80$
So, say $17\% \to 17\%(120) + 80 =100.4$. And $80\% \to 80\%*120 + 80 =  176$ etc.
