If I knew the name of the formula, it'd be easy to just google it and find out. However, I don't and I count on you, mathematicians to give me a hand in this.
Let's say we have two constants
x = 4
y = 6
and a 3rd variable "z" that could be between 4 and 6. I am looking for the percentage z is from y assuming that if z is 4 it is 0%.
I need to use such a formula to calculate intervals in a game I am supposed to make. If the boundary was 0 - 6 it couldn't have been easier - z * 100 / y, but it is 4 - 6.
So the percentage is $\frac{z-x}{y-x}\cdot 100$