How to calculate percentage of value inside arbitrary range?

$$ \frac{{n - 174}}{{424 - 174}} \times 100. $$ In your example, $n=230$.


The full range is from $174$ to $424$. The distance between these is $424-174$, which is $250$.

The current value of the slider is $230$.This is $230-174$, that is, $56$ larger than the minimum possible value.

We are interested in the ratio $56/250$. A calculator shows that $56/250=0.224$. We want to express $0.224$ as a percentage. To do that, we multiply $0.224$ by $100$. The result is $22.4$. So the required percentage setting for $230$ is $22.4\%$.

Since we will not always be dealing with the setting $230$, let's generalize a little. Suppose that the slider setting is $S$. (In your question, $S=230$.) Assume that $174 \le S \le 424$.

Then the distance from $S$ to the minimum $174$ is $$S-174.$$ The ratio of this distance to the full distance $474-174$ is $$\frac{S-174}{424-174}.$$

To turn this into a percentage, multiply by $100$. The answer is $$\left(\frac{S-174}{424-174}\right)\times 100 \:\:\%.$$

Reality check: It is quite easy to make mistakes, I have done it hundreds of times. So let's see what answer we get from the above formula when $S=174$. Substitute $174$ for $S$. We get $0\%$. Good. Let's see what answer we get if we put $S=424$. Substitute. We get $100\%$. In general, spot checks of this kind do not guarantee that a formula is correct, but they are good evidence that we have not made a horrible blunder. (In linear cases, such as this one, two spot checks in fact do guarantee correctness.)

Now let us adjust the formula so that we can deal with a different situation, where the minimum setting is $m$ and the maximum setting is $M$. Let $m\le S \le M$. Then the percentage that corresponds to the setting $S$ is given by $$\left(\frac{S-m}{M-m}\right)\times 100 \:\:\%.$$ The reasoning that gives this formula is exactly the same as the one we used for the concrete numbers you supplied.

Now that we have a formula that gives the percentage $P$ when we know the setting $S$, we can use a little algebra to get a formula that gives the setting $S$ if we are told the desired percentage $P$. If you have need of such a formula, and have difficulty deriving it, please leave a message.