如何获得表中最后N行的平均值? [英] How does one get the average of the last N rows in a table?

查看:138
本文介绍了如何获得表中最后N行的平均值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张表(表)。表不会从电子表格的第一行开始(表上方有空行)。表中没有空白项目。表包含OtherColumn(通过它排序)和Column。

  OtherColumn列
a1 b1
a2 b2
... ... $ b我想要查找列中最后N个项目的平均值,$ b $ a
$ / code $ <$ $ $ $ $ $ $ $ $ $ $ $



我当前的策略涉及= AVERAGE(OFFSET(M,-10,0),M)其中M是列中最后一项的单元格引用。如何找到M?



喜欢使用非VBA解决方案。寻找一个更优雅的解决方案M:

  CELL(address,OFFSET(Leaders [[#Headers],[列]],COUNTA(B13:B1048576)-1,0))

其中C13是标题表中的行和C1048576是电子表格中B列的最后一行。

解决方案

尝试这一个:

  = AVERAGE(INDEX(Table1 [Column],ROWS(Table1 [Column]) -  17):INDEX(Table1 [Column],ROWS Table1 [Column])))

上面的公式获得列<$ c $中的最后18个元素的平均值c>列



或使用 OtherColumn

  = AVERAGEIFS(Table1 [Column],Table1 [OtherColumn],> =& LARGE(Table1 [OtherColumn],18))


I have a table (the "Table"). Table does not start on the first row of the spreadsheet (there are blanks rows above Table). There are no blank items in Table. Table contains OtherColumn, by which it is sorted, and Column.

OtherColumn    Column
a1             b1
a2             b2
...            ...
aN             bN

I want to find the average of the last N items in Column.

My current strategy involves =AVERAGE(OFFSET(M, -10, 0), M) where M is a cell reference to the last item in Column. How do I find M?

Prefer a non-VBA solution. Looking for a more elegant solution for M than:

CELL("address", OFFSET(Leaders[[#Headers],[Column]], COUNTA(B13:B1048576)-1, 0)) 

where C13 is the header row of the Table and C1048576 is the last row in Column B in the spreadsheet.

解决方案

Try this one:

=AVERAGE(INDEX(Table1[Column],ROWS(Table1[Column])-17):INDEX(Table1[Column],ROWS(Table1[Column])))

formula above gets average of last 18 elements in column Column.

Or using OtherColumn:

=AVERAGEIFS(Table1[Column],Table1[OtherColumn],">="&LARGE(Table1[OtherColumn],18))

这篇关于如何获得表中最后N行的平均值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆