简体   繁体   English

excel中的平均比率公式

[英]Average ratio formula in excel

I've got two cells with the following data in them:我有两个单元格,其中包含以下数据:

W7=2:1, W8=2:1

I am trying to get the average of these two cells but cannot figure it out since they are ratios.我试图获得这两个单元格的平均值,但无法弄清楚,因为它们是比率。 Obviously, the average should come out to 2:1 since (2:1 + 2:1) / 2 = 2:1 but it doesn't seem to be that simple when trying to calculate in Excel.显然,平均值应该是 2:1,因为 (2:1 + 2:1) / 2 = 2:1 但在 Excel 中尝试计算时似乎并不那么简单。

Is there a formula that can achieve this?有没有可以实现这一点的公式?

A little side note, the formula I am using to create the ratio is:一个小小的旁注,我用来创建比率的公式是:

=ROUND((U8-M8)/(M8-V8),2)&":1"

So you can see, the 1 is just added and will be the same every time.所以你可以看到, 1 刚刚添加并且每次都是相同的。 That number is not actually being calculated.这个数字实际上并没有被计算出来。

If you can be happy with a result of 4:2 then,如果你对4:2的结果感到满意,那么,

=SUMPRODUCT(--REPLACE(W7:W8, FIND(":", W7:W8), LEN(W7:W8), TEXT(,)))&":"&SUMPRODUCT(--REPLACE(W7:W8, 1, FIND(":", W7:W8), TEXT(,)))

If you want to try and resolve the ratio down to x:1, VBA may be a better solution.如果您想尝试将比率解析为 x:1,VBA 可能是更好的解决方案。

Per your recent addendum to the question, perhaps this will work.根据您最近对该问题的补充,也许这会奏效。

=ROUND(SUMPRODUCT(--REPLACE(W7:W8, FIND(":", W7:W8), LEN(W7:W8), TEXT(,)))/COUNTA(W7:W8), 2)&":1"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM