I have a range of values that I input into a spreadsheet. I need the ranges to output a percentage where the result of all percentages equals 100%.
- 18 - 5.28%
- 3 - 31.70%
- 14 - 6.79%
- 12 - 7.92%
- 4.5 - 21.13%
- 3.5 - 27.17%
The above percentages are what I need each value to equal. I figure this out by just tinkering with number and forcing the equation to equal what I wanted it to.
But I need an equation where even if the values on the left side are changed completely ranging between 1 and 24 that the percentages on the right side still add up to 100%.
The idea is that the number 18 means it took 18 hours to sell. And because it took 18 hours to sell, I want to buy less than the one that took 3 hours to sell. I only have so much money to spend, so the total percentage of all of them cannot be more than 100% or else I will spend more than I have.
If I understand correctly, your problem is: given values $a_1, \ldots, a_n$ in the range 0 to 24 (hrs), find percentages $p_1, \ldots, p_n$ such that:
If we wanted to satisfy only the third constraint, we would pick some constant $C$ and define
$$\widehat p_k \equiv C/a_k.$$
To satisfy the first and second constraints, we must normalize these values. Hence, we put
$$\begin{align*}p_k &\equiv \frac{\widehat p_k}{\sum_i \widehat p_i}\\ &= \frac{C/a_k}{\sum_i C/a_i}\\&= \frac{1/a_k}{\sum_i 1/a_i}\end{align*}$$
which satisfies all three constraints.
An easier way to calculate this in a spreadsheet is this: