[英]How do I calculate average in Excel between an undefined set of cells?
I have a table that looks like this: 我有一个看起来像这样的表:
User Interval
270 new user
270 30
270 18
270 7
295 new user
295 50
295 30
310 new user
310 40
317 new user
For each user, I'd like to know the average and the max interval. 对于每个用户,我想知道平均和最大间隔。 My problem is that I don't know how to calculate an average that will run only between 2 values of
new user
, and the amount of intervals per user is not set. 我的问题是我不知道如何计算仅在
new user
2个值之间运行的平均值,并且未设置每个用户的间隔量。 Is there a way to do it in Excel? 有没有办法在Excel中执行此操作?
Thanks! 谢谢!
As codenut says you can use AVERAGEIF
for an average (If you have Excel 2007 or a later version) but there is no "MAXIF" function so you need an "array formula" for that. 正如codenut所说,你可以平均使用
AVERAGEIF
(如果你有Excel 2007或更高版本),但是没有“MAXIF”功能,所以你需要一个“数组公式”。
Assuming data in columns A and B try this formula in C2 假设A列和B列中的数据在C2中尝试此公式
=IF(B2="New user",AVERAGE(IF(A2:A$1000=A2,B2:B$1000)),"")
once you have pasted that in C2 you need to press F2 to select formula then hold down CTRL and SHIFT keys and press ENTER. 一旦你在C2中粘贴了它,你需要按F2选择公式然后按住CTRL和SHIFT键并按ENTER键。 That will put curly braces like { and } around the formula in the formula bar - now copy formula down column.
这将在公式栏中的公式周围加上{和}等大括号 - 现在将公式复制到列中。
Repeat for D2 with exactly the same formula except replace AVERAGE
with MAX
使用完全相同的公式重复D2,除了用
MAX
替换AVERAGE
You will get the max and average for each user at the top of each with other lines blank 您将获得每个用户顶部的最大值和平均值,其他行为空白
This works for up to 1000 rows - change formula as required if you have more data. 这最多可用于1000行 - 如果您有更多数据,则根据需要更改公式。
perhaps the averageif function can help you out? 也许averageif函数可以帮助你? http://office.microsoft.com/en-us/excel-help/averageif-function-HA010047433.aspx
http://office.microsoft.com/en-us/excel-help/averageif-function-HA010047433.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.