X
X
XWR2021-09-26 15:44:58
Mathematics
XWR, 2021-09-26 15:44:58

How to calculate the percentage difference between two numbers?

I want to calculate the percentage difference between two numbers.

Like in the picture I want to do:

61506b2eb8b93125199996.jpeg
The formula a / b * 100 does not fit.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Tony, 2021-09-26
@XWR

12 / (12+16) * 100 - - - win rate
16 / (12+16) * 100 - - - loss rate
12+16 - - - total games

V
Vasily Bannikov, 2021-09-26
@vabka


The formula a / b * 100 is not suitable.

Great if you know what to put in.
Percentages must be taken from something - so some number must be taken as 100%
If we want to calculate the percentage of losses among all games, then:
a = number of losses
b = number of games = number of wins + number of losses
16 / (16 + 12) = share losses
To get the percentage, simply multiply by 100 and get 57.14%

A
Alexey Deshcherevsky, 2021-09-27
@adeshere

I also want to remind you about one nuance: if the calculations are in integers. then a/(a+b) will give 0, and in the end it will also be 0. So don't forget to float(). And for integer percentages, I do this: a * 100 / (a ​​+ b). True, if the numbers are large, we must not forget about the possibility of overflow at the moment *100. So it's better to float $-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question