简体   繁体   English

如何使用Excel查找某个变量的最后一个数字(连续)

[英]How to find last number (in a row) for a certain variable using excel

The implementation include a lot of data. 该实现包含大量数据。 For simple example in this Image I should be able to find the last number in the row either "500" for "Amy", "700" for "Sam", etc. 对于此图像中的简单示例,我应该能够找到行中的最后一个数字:“ Amy”为“ 500”,“ Sam”为“ 700”,等等。

Kindly need all your help to figure this out. 请您全力以赴,以解决此问题。 Thanks in advance.. 提前致谢..

在此处输入图片说明

The following formula entered as array formula (by using Ctrl+Shift+Enter) could be used: 可以使用以下输入为数组公式的公式(通过使用Ctrl + Shift + Enter):

=INDEX($C$2:$C$9,MAX(($A$2:$A$9=E2)*(ROW($A$2:$A$9)-ROW($A$2)+1)))

For F2, where the last amount for Amy is being calculated: 对于F2,正在计算Amy的最后金额:

($A$2:$A$9=E2) returns an array of True and False for those that match Amy ($A$2:$A$9=E2)返回与Amy匹配的True和False数组

(ROW($A$2:$A$9)-ROW($A$2)+1) gives an array for the rows in the dataset. (ROW($A$2:$A$9)-ROW($A$2)+1)为数据集中的行提供一个数组。 $A$2:$A$9 is the range for the names, $A$2 is the first name in the dataset. $A$2:$A$9是名称的范围, $A$2是数据集中的名字。

The two above multipled together gives the row numbers in which Amy was found. 上面两个的倍数给出了找到Amy的行号。

MAX() then gives the highest row number, which is used by INDEX to retrieve the Amount matching this row number. 然后, MAX()给出最高的行号,INDEX使用它来检索与该行号匹配的Amount。

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

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