This is basically linear scaling with an initial offset:
p = 100 * (value - min) / (max - min)
Note that this assumes that value
is in the interval [min, max]
and max != min
. This gives you the percentage as a number between 0
and 100
.