跳到主要内容

在输入新数字时,如何平均一列的最后5个值?

在Excel中,您可以使用“平均值”功能快速计算一列中最后5个值的平均值,但是,您不时需要在原始数据后面输入新的数字,并且您希望平均值会自动更改为输入新数据。 也就是说,即使不时添加数字,您也希望平均值始终反映数据列表的最后5个数字。

列的最后5个值的平均值,作为使用公式输入的新数字


箭头蓝色右气泡 列的最后5个值的平均值,作为使用公式输入的新数字

以下数组公式可以帮助您解决此问题,请执行以下操作:

在空白单元格中输入以下公式:

=IF(COUNT(A:A),AVERAGE(INDEX(A:A,LARGE(IF(ISNUMBER(A1:A10000),ROW(A1:A10000)),MIN(5,COUNT(A1:A10000)))):A10000),"no data") (答: 是包含您使用的数据的列, A1:A10000 是动态范围,您可以根据需要扩展它,并且数量 5 表示最后一个n值。),然后按 Ctrl + Shift + Enter 键一起获得最后5个数字的平均值。 看截图:

文档平均最后 5-1

现在,当您在原始数据后面输入新数字时,平均值也会随之更改,请参见屏幕截图:

文档平均最后 5-2

备注:如果单元格列包含0个值,则要从最后0个数字中排除5个值,以上公式将不起作用,在这里,我可以向您介绍另一个数组公式,以获取最后5个非零值的平均值,请输入以下公式:

=AVERAGE(SUBTOTAL(9,OFFSET(A1:A10000,LARGE(IF(A1:A10000>0,ROW(A1:A10000)-MIN(ROW(A1:A10000))),ROW(INDIRECT("1:5"))),0,1))),然后按 Ctrl + Shift + Enter 获得所需结果的键,请参见屏幕截图:

文档平均最后 5-3


相关文章:

如何在Excel中每5行或每列平均一次?

如何平均Excel中的前3个值?

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bonjour,

La formule ne fonctionnant pas chez moi, et ayant un fort besoin de l'avoir, j'ai creusé l'affaire.
Je ne comprenais pas pourquoi utiliser la fonction LARGE qui n'est là que si on cherche la plus grande valeur d'une colonne, qui n'est pas forcément dans les 5 derniers.

Donc, voici une formule simple (en français, mais vous trouverez facilement l'équivalent anglais) :
=MOYENNE(INDEX(A2:A1000;NB(A2:A1000)-5+1):A1000)
This comment was minimized by the moderator on the site
Hello Yves,

You can use the simple formula: =AVERAGE(OFFSET(A1,COUNT(A:A),0,-5)). Please have a try. Please see the attached picture.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
25% x (r) = (n), rounded up to the next whole number = (a) then the top (a) race points are averaged together to get the total race points (p) for the week.

Example: 25%x9 = 2.25 rounded up to 3. Top 3 races of the 9 races are averaged to get the total points for the week.

How do I create a formula in excel for this?
This comment was minimized by the moderator on the site
Hello, I would like average the lowest 10 values of the last 20 added to a set of data. After reading this one here and another one of your examples, I now know how to average the lowest 10 values of 20 and how to grab only the last 20 values for averaging, but I need to combine them so I only average the lowest 10 values of the last and or most resent 20 add to the set of data. Please let me know if you can help, thank you JT.
This comment was minimized by the moderator on the site
=IF(COUNT(A:A),AVERAGE(INDEX(A:A,LARGE(IF(ISNUMBER(A1:A10000),ROW(A1:A10000)),MIN(5,COUNT(A1:A10000)))):A10000),"no data")

Does not work for me.

Here is my version:
=IF(COUNT(C:C),AVERAGE(INDEX(C:C,LARGE(IF(ISNUMBER(C2:C10000),ROW(C2:C10000)),MIN(5,COUNT(C2:C10000))))):C10000)

The error I get is: Wrong data type.
This comment was minimized by the moderator on the site
Hello, Paul,
Do you press the Ctrl + Shift + Enter keys together after pasting the above formula?
Please try it.
This comment was minimized by the moderator on the site
I tried the formual =IF(COUNT(A:A),AVERAGE(INDEX(A:A,LARGE(IF(ISNUMBER(A1:A10000),ROW(A1:A10000)),MIN(5,COUNT(A1:A10000)))):A10000),"no data") then did COMMAND RETURN on my Mac and the formula worked but it didn't average the lowest 10 of the last 20 values correctly.I would like to average the lowest 8 values of of the last or most recent 20 values in a dynamic range as I enter a new value every day. Any help would be greatly appreciated!
This comment was minimized by the moderator on the site
Hello, Don,To solve your problem, please apply the below array formula:=AVERAGE(SMALL(IF((A1:A10000<>0)*(IF(ISNUMBER(A1:A10000),ROW(A1:A10000))=LARGE(IF(ISNUMBER(A1:A10000),ROW(A1:A10000)),{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20})),A1:A10000),{1,2,3,4,5,6,7,8}))
After inserting the formula, please press 
This comment was minimized by the moderator on the site
Thank you! When I verify I do not get the correct value. My last 20 values are as follows: 0.0    0.2    8.9    2.9    8.1    8.1    8.1    5.3    8.1    0.4    6.6    -0.5    0.2    9.0    9.0    5.1    3.6    1.9    4.6    1.3Your array gives an average of 1.2 for the 8 lowest valuesMy average is 0.8 for the 8 lowest values.Not sure what went wrong?
This comment was minimized by the moderator on the site
I think it doesn't average zero. I tired <=> and that is not a solution.
This comment was minimized by the moderator on the site
Hi, Don,Yes, as you said, the formula exclude the 0s when averaging, if you want to average with 0s, please apply the below formula:=AVERAGE(SMALL(IF(ISNUMBER(A1:A10000)*(IF(ISNUMBER(A1:A10000),ROW(A1:A10000))=LARGE(IF(ISNUMBER(A1:A10000),ROW(A1:A10000)),{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20})),A1:A10000),{1,2,3,4,5,6,7,8}))
Please remember to press Ctrl + Shift + Enter keys together.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations