如何使用 VBA 从每日数据计算季度平均值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22695100/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to calculate quarterly averages from daily data with VBA?
提问by user137425
I have daily data from 01.01.1990. to 31.12.2012. I need to calculate quarterly averages from the daily data with a VBA function. Is there an efficient way to do this?
我有 1990 年 1 月 1 日的每日数据。到 31.12.2012。我需要使用 VBA 函数根据每日数据计算季度平均值。有没有一种有效的方法来做到这一点?
Any help is appreciated!
任何帮助表示赞赏!
回答by Brad
Put your data in a pivot table. Put your Date values in the Rows and put your numeric values in the Values
. Right click on the date data and select Group...
将您的数据放入数据透视表中。将您的日期值放在行中,并将您的数值放在Values
. 右键单击日期数据并选择Group...
To make sure you are taking the average right click on your numeric data and select Value Field Settings
为了确保您对数字数据进行平均右键单击并选择 Value Field Settings
You'll get something that looks like this
你会得到看起来像这样的东西