# Given $X$ and $Y$ and a percent, how do I calculate the quantity that is that percent between them?

Here is a really dumb question, but I cannot find answers on Google for some reason or other. All the answers seem to be buried under mounds of percent difference formulas (which is not what I am asking).

I am trying to generate a value between two variables based on a percentage.

\begin{align*} 0\% &= X \qquad \text{(the minimum value)}\\\\ 50\% &= \frac{X + Y}{2}\\\\ 100\% &= Y\qquad \text{(the maximum value)} \end{align*}

What would the formula be?

-
Readers, it might be useful to know that this is essentially the lerp() function, which stands for linear interpolation. I figured this out after a little under a month that I posted. –  FizzledOut Sep 2 '13 at 7:57

$$X+(\text{percent here})\cdot(Y-X)$$ So for example,
$X+(25\%)\cdot(Y-X)$ is $25$ percent of the way to $Y$, from $X$.
The formula for "$t$ percent", where $t$ is any number between $0$ and $100$, is $$\left(1-\frac{t}{100}\right)X+\left(\frac{t}{100}\right)Y$$