This is a short guide on how to calculate the reverse percentage of a given number. i.e. You have the percentage number and the percentage, but you need to calculate the original number that it came from.
Take a look at the following PHP example, as the code will probably explain it better than words:
//Our value, which we know is 77% //of the original number. $percentageValue = 72985; //The percentage value, which //we already know is 77. This is sometimes //called the final number. $percentage = 77; //Now, let's calculate the //original number. i.e. If 72985 is 77%, then //which number is it 77% of? $originalNum = ($percentageValue / $percentage) * 100; //In this case, 72985 is 77% of 94785.71 echo "$percentageValue is $percentage of $originalNum";
In the code snippet above, we know that 72,985 is 77% of X. However, we do not know what X is. X in this case is the original number that 72,985 came from.
In order to calculate the original number, we need to do a reverse percentage calculation and divide the percentage into the percentage value. The percentage value is often referred to as the final number.
Once we divide the percent into the final number, we simply multiply the result by 100. This gives us the original number.
Note that if you want the original number in a format that only has two decimal places, you can simply use PHP’s number_format function like so:
//Round it to two decimal places. $originalNum = number_format($originalNum, 2); echo $originalNum;
This leaves us with 94,785.71. This makes sense, as 72,985 is 77% of 94,785.71.
To sum up the terms above:
- Final number: 72,985
- Percent: 77%
- Original number: 94,785.71
Hopefully, this guide helped to clear a few things up!