简体   繁体   English

根据 CustomerID 计算 3 个月的平均值

[英]Calculate 3 month Average on the base of CustomerID

I am trying to calculate three month average sales in excel wrt customerid in excel.我正在尝试在excel中计算三个月的平均销售额,而在excel中使用customerid。 I tried by doing it by AverageIfs function but nothing helped.我尝试通过AverageIfs函数来做,但没有任何帮助。

A              B         C
Orderdate      sales    customerid
5/15/2019        7           1
5/15/2019        48.5        1
4/15/2019       92.94        1
3/17/2019     102.85         1
3/18/2019      49            1
3/18/2019     119.95         1
2/18/2019     58.96          1
1/20/2019      14.6         1
5/16/2019      17           6
4/15/2019     148.5         6
4/12/2019    912.94         6
3/17/2019   102.85          6
9/18/2018    22.34          6

Formula I tried: =AVERAGEIFS(B:B,C:C,C2)

output expected:预期输出:

customerid      average(3 months)
1                    49.48         
6                   359.48

Let's start from today's date and the date 3 months ago (Make it dynamic):让我们从今天的日期和 3 个月前的日期开始(让它变得动态):

Remember to change the cell format from General to Date.请记住将单元格格式从常规更改为日期。 Otherwise, it will show [43563]否则,它会显示 [43563]

在此处输入图片说明

Next use the date as part of our filter:接下来使用日期作为我们过滤器的一部分:

在此处输入图片说明

在此处输入图片说明

Now you should get the most recent 3 months data:现在你应该得到最近 3 个月的数据:

在此处输入图片说明


Copy the filtered data into a new spreadsheet将过滤后的数据复制到新的电子表格中

Copy the filtered data into a new spreadsheet将过滤后的数据复制到新的电子表格中

Copy the filtered data into a new spreadsheet将过滤后的数据复制到新的电子表格中


Next Step: get the distinct customer ID:下一步:获取不同的客户 ID: 在此处输入图片说明 在此处输入图片说明

You will get this:你会得到这个:

在此处输入图片说明

Last Step:最后一步:

Use the function "AVERAGEIF":使用函数“AVERAGEIF”:

在此处输入图片说明

Done!完毕!

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

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