Calculate percentage based on specific 0% and 100% in any numeric range

percentages

I know there are solutions to this, but for some reason they don't seem to work correctly in my scenario.

I need to weight an actual value against a nominal value and a certain upper and lower tolerance threshold.

In order to work with it in a way that makes sense to me as a programmer, I'd like to have my nominal value Vn to be 0% whereas my positive tolerance treshold Tu would be 100%. So any value above that tolerance field would be >100%. I need the same for a lower tolerance threshold Tl. Now there are plenty of scenarios where I would have a negative lower threshold and a positive nominal and upper threshold whereas the actual value could lie anywhere in between or outside those boundaries.

I guess there's no universal algorithm, so I probably would need two, one considering the lower threshold as 100% and one that considers the upper as 100%.

I stumbled across this Thread which comes close to what I want. I tried it in Excel and indeed I get 100% for my upper threshold. But it seems to scale wrong as my nominal value is not 0% and double the threshold is way beyond 200%.

I tried a lot but I can't figure out how to get this working correctly.

Best Answer

Meanwhile I found the solution to this issue. It's easier than I thought.

You have a nominal value $N$, your actual value $A$ and two relative tolerance thresholds $T_L$ and $T_U$. So in order to calculate the percentage $P$ based on this field would result in the following formula whereas

$$ T = \begin{cases} A < N, T_L \\ A > N, T_U \end{cases} $$

$$ P=\frac{A-N}{T} $$

This returns in a decimal percentage, by multiplying with $100$ you end up with a percentage value.

For example: $$ T_U = 0.5 \\ N = 1 \\ T_L = -1.5 $$

would result in the following equation: $$ A=1.35\\ T=T_U\\ P =\frac{1.35-1}{0.5}=\frac{0.35}{0.5}=0.7=70\% $$ The absolute tolerance would be $N+T_U=1.5$ which looks good.

with $T_L$ used: $$ A=-0.2\\ T=T_L\\ P=\frac{-0.2-1}{-1.5}=\frac{-1.2}{-1.5}=0.8=80\% $$

The absolute tolerance would be $N-T_L=-0.5$ so this looks good.

Related Question