I have a set of statistics that I need to find the overall ratio to. This example will work with only two items so I'll write them down:
A | B
---------
12 | 5
6 | 2
The total ratio needs to be worked out as: (12 + 6) / (5 + 2)
Which is 2.57
The problem however, is that the ratio of each row can be modified by a user, meaning the source values A and B can only be used as "default" sources.
To allow partial modification of the entire set by modifying specific ratios I saved the ratios of each individual row like this:
A | B | R
-------------
12 | 5 | 2.4
6 | 2 | 3
I then attempted to come to the same overall ratio (since at the moment these ratios are un-modified), however getting the mean average did not work:
(2.4 + 3) / 2 = 2.7
The fact that the ratios can be modified make the original source data completely irrelevant in the overall statistic, but I still need to arrive at 2.57, is this possible?
I am prepared to change the type of modifiable information stored against each row, providing it can still be used to represent a percentage.
I dont understand programming, but what I can tell you is $\frac{a+b}{c+d} \neq \frac{\frac{a}{b}+\frac{c}{d}}{2}$, that is why it didn't work. What you can do is may be, try $\frac{a+b}{c+d}=\frac{\frac{a}{b}+1}{\frac{c}{d}+1}.\frac{b}{d}$.
In you example $a=12,b=6,c=5,d=2$ which will give you $2.57$