gpt4 book ai didi

excel - 使用 SumProduct 的加权 AverageIFs 语句

转载 作者:行者123 更新时间:2023-12-03 03:21:51 24 4
gpt4 key购买 nike

我们都知道 AverageIfs 的作用。但是,如果我想将 AverageIFs 语句转换为基于另一列中的数据的加权平均值,该怎么办?假设在“主”选项卡中,每行在 H 列中都有一个数量。正如您现在所看到的,我根据 C 列中的条件对 J 列中的价格进行平均。问题:每行都有一个唯一的数量,因此根据 H 行中满足条件的数量进行加权平均,比基本平均价格更准确。有人对如何改变这个公式有任何想法吗?

ProductHier Common Name  Total Sls   Total Fct  2017 avg price  2018 avg price
B1B1403A01 ACC - Finished Goods 2,448 2,612 99 118
B1B1403A02 ACC - Finished Goods 3,143 3,350 165 180
B1B1403A05 ACC - Finished Goods 709 613 162 152
B1B1403A06 ACC - Finished Goods 206 150 123 142
B1B1403A07 ACC - Finished Goods 1,714 1,441 152 142
B1B1403A08 ACC - Finished Goods 253 295 142 160
B1B1403A09 ACC - Finished Goods 2,447 2,435 88 98
B1B1403A11 ACC - Finished Goods 2,334 3,281 149 174





=SUMPRODUCT((Master!C2:C5000='Forecast Calc'!D2)*Master!H2:H5000,Master!J2:J5000)/SUMIFS(Master!H:H,Master!C:C,'Forecast Calc'!D2,Master!J:J,"<>0")

最佳答案

使用 SUMPRODUCT 除以 SUMIF:

=SUMPRODUCT((F2:F9="ACC - Finished Goods")*H2:H9,J2:J9)/SUMIFS(H2:H9,F2:F9,"ACC - Finished Goods",J2:J9,"<>0")

enter image description here

关于excel - 使用 SumProduct 的加权 AverageIFs 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50069824/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com