简体   繁体   English

根据多个条件计算前 3 名产品的每日平均销售额

[英]Calculate Daily Average Sales for top 3 products based on multiple conditions

I have an excel product sales table looking like this (last column is empty, i've just populated the result I'm looking to calculate):我有一个 excel 产品销售表,看起来像这样(最后一列是空的,我刚刚填充了我要计算的结果):

Date日期 Sales销售量 Retailer零售商 ProductName产品名称 ProductType产品类别 Top 3 daily AVG Sales每日平均销售额前 3 名
01/01/2021 2021 年 1 月 1 日 1000 1000 Retailer 1零售商 1 Product 1产品一 Mobile移动的 2100 2100
01/01/2021 2021 年 1 月 1 日 2000 2000 Retailer 1零售商 1 Product 2产品 2 Desktop桌面
01/01/2021 2021 年 1 月 1 日 700 700 Retailer 1零售商 1 Product 3产品 3 Desktop桌面
01/01/2021 2021 年 1 月 1 日 1250 1250 Retailer 1零售商 1 Product 4产品 4 Mobile移动的 2100 2100
01/01/2021 2021 年 1 月 1 日 2200 2200 Retailer 1零售商 1 Product 5产品 5 Mobile移动的 2100 2100
01/01/2021 2021 年 1 月 1 日 1700 1700 Retailer 1零售商 1 Product 6产品 6 Desktop桌面
01/01/2021 2021 年 1 月 1 日 2700 2700 Retailer 1零售商 1 Product 7产品 7 Mobile移动的 2100 2100
01/01/2021 2021 年 1 月 1 日 1400 1400 Retailer 1零售商 1 Product 8产品 8 Mobile移动的 2100 2100
01/01/2021 2021 年 1 月 1 日 1200 1200 Retailer 1零售商 1 Product 9产品 9 Desktop桌面
01/01/2021 2021 年 1 月 1 日 1650 1650 Retailer 1零售商 1 Product 10产品 10 Desktop桌面
01/01/2021 2021 年 1 月 1 日 1200 1200 Retailer 2零售商 2 Product 1产品一 Mobile移动的
01/01/2021 2021 年 1 月 1 日 1000 1000 Retailer 2零售商 2 Product 2产品 2 Desktop桌面
01/01/2021 2021 年 1 月 1 日 600 600 Retailer 2零售商 2 Product 3产品 3 Desktop桌面
01/01/2021 2021 年 1 月 1 日 2250 2250 Retailer 2零售商 2 Product 4产品 4 Mobile移动的
01/01/2021 2021 年 1 月 1 日 1450 1450 Retailer 2零售商 2 Product 5产品 5 Mobile移动的
01/01/2021 2021 年 1 月 1 日 1600 1600 Retailer 2零售商 2 Product 6产品 6 Desktop桌面
01/01/2021 2021 年 1 月 1 日 1700 1700 Retailer 2零售商 2 Product 7产品 7 Mobile移动的
01/01/2021 2021 年 1 月 1 日 1800 1800 Retailer 2零售商 2 Product 8产品 8 Mobile移动的
01/01/2021 2021 年 1 月 1 日 1300 1300 Retailer 2零售商 2 Product 9产品 9 Desktop桌面
01/01/2021 2021 年 1 月 1 日 1100 1100 Retailer 2零售商 2 Product 10产品 10 Desktop桌面
01/02/2021 2021 年 1 月 2 日 1000 1000 Retailer 1零售商 1 Product 1产品一 Mobile移动的
01/02/2021 2021 年 1 月 2 日 2000 2000 Retailer 1零售商 1 Product 2产品 2 Desktop桌面
01/02/2021 2021 年 1 月 2 日 700 700 Retailer 1零售商 1 Product 3产品 3 Desktop桌面
01/02/2021 2021 年 1 月 2 日 1250 1250 Retailer 1零售商 1 Product 4产品 4 Mobile移动的
01/02/2021 2021 年 1 月 2 日 2200 2200 Retailer 1零售商 1 Product 5产品 5 Mobile移动的
01/02/2021 2021 年 1 月 2 日 1700 1700 Retailer 1零售商 1 Product 6产品 6 Desktop桌面
01/02/2021 2021 年 1 月 2 日 2700 2700 Retailer 1零售商 1 Product 7产品 7 Mobile移动的
01/02/2021 2021 年 1 月 2 日 1400 1400 Retailer 1零售商 1 Product 8产品 8 Mobile移动的
01/02/2021 2021 年 1 月 2 日 1200 1200 Retailer 1零售商 1 Product 9产品 9 Desktop桌面
01/02/2021 2021 年 1 月 2 日 1650 1650 Retailer 1零售商 1 Product 10产品 10 Desktop桌面
01/02/2021 2021 年 1 月 2 日 1200 1200 Retailer 2零售商 2 Product 1产品一 Mobile移动的
01/02/2021 2021 年 1 月 2 日 1000 1000 Retailer 2零售商 2 Product 2产品 2 Desktop桌面
01/02/2021 2021 年 1 月 2 日 600 600 Retailer 2零售商 2 Product 3产品 3 Desktop桌面
01/02/2021 2021 年 1 月 2 日 2250 2250 Retailer 2零售商 2 Product 4产品 4 Mobile移动的
01/02/2021 2021 年 1 月 2 日 1450 1450 Retailer 2零售商 2 Product 5产品 5 Mobile移动的
01/02/2021 2021 年 1 月 2 日 1600 1600 Retailer 2零售商 2 Product 6产品 6 Desktop桌面
01/02/2021 2021 年 1 月 2 日 1700 1700 Retailer 2零售商 2 Product 7产品 7 Mobile移动的
01/02/2021 2021 年 1 月 2 日 1800 1800 Retailer 2零售商 2 Product 8产品 8 Mobile移动的
01/02/2021 2021 年 1 月 2 日 1300 1300 Retailer 2零售商 2 Product 9产品 9 Desktop桌面
01/02/2021 2021 年 1 月 2 日 1100 1100 Retailer 2零售商 2 Product 10产品 10 Desktop桌面

In the Top 3 daily AVG Sales column I'm looking to write a formula that calculates the average top 3 sales for each day per Retailer and Product Type.在前 3 名每日平均销售额列中,我希望编写一个公式来计算每个零售商和产品类型每天的平均前 3 名销售额。 So, if date is 01/01/2021 and Retailer is Retailer 1 and ProductType is Mobile, find the top 3 sales and average them => (2200+2700+1400)/3 = 2100因此,如果日期是 01/01/2021,Retailer 是 Retailer 1,ProductType 是 Mobile,则找出前 3 名的销售额并取平均值 => (2200+2700+1400)/3 = 2100

Appreciate any help with this.感谢您对此的任何帮助。

You can try-你可以试试-

=AVERAGE(INDEX(SORT(FILTER($B$3:$B$42,($A$3:$A$42=A3)*($C$3:$C$42=C3)*($E$3:$E$42=E3)),,-1),{1,2,3}))

Edit: Try below array formula for non O365 excels.编辑:尝试以下非O365擅长的数组公式。 Must be enters nu CTRL+SHIFT+ENTER .必须输入 nu CTRL+SHIFT+ENTER

=AVERAGE(LARGE(IF(($A$2:$A$42=A2)*($C$2:$C$42=C2)*($E$2:$E$42=E2),$B$2:$B$42,""),{1,2,3}))

Press CTRL + SHIFT + ENTER to evaluate the formula as it is an array formula.CTRL + SHIFT + ENTER计算公式,因为它是一个数组公式。

在此处输入图像描述

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

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