简体   繁体   English

在Excel中查找具有特定值的列中最后一行的行号

[英]Finding the row number of last row in column with a specific value in excel

So I have a column with values, and I am looking for the highest/latest row number with a specific value. 所以我有一列带有值,并且我正在寻找具有特定值的最高/最新行号。 An example: 一个例子:

在此处输入图片说明

In this case, I want a function that when searching for the last row number, within the value range, containing 0, it would return 8. 在这种情况下,我想要一个函数,当在值范围内搜索包含0的最后一行时,它将返回8。

Another option is to get the index of the first empty cell and subtract 1. 另一种选择是获取第一个空单元格的索引并减去1。

Thanks 谢谢

To find row number of last 0 in a range you can use: 要查找范围内最后0个的行号,可以使用:

=LOOKUP(2,1/(A1:A11=0),ROW(A1:A11))

Edit: To exclude empty cells from result: 编辑:要从结果中排除空白单元格:

=LOOKUP(2,1/((A1:A11=0)*(A1:A11<>"")),ROW(A1:A11))

Try this: 尝试这个:

=MAX(IF(LookFor=LookIn,ROW(LookIn),0))

entered as an array formula CTRL-SHIFT-ENTER. 输入为数组公式CTRL-SHIFT-ENTER。 LookFor is the value you're looking for, say 0, and LookIn is the range you're searching, say A1:A15. LookFor是要查找的值,例如0, LookIn是要搜索的范围,例如A1:A15。

Hope that helps 希望能有所帮助

=MAX(IF(ISERROR(E897:E908),0,IF(E897:E908=0,ROW(E897:E908),0)))-ROW(E897)+1

CTRL + ENTER + SHIFT我只是检查该行是否不包含错误,如果不包含错误,是否具有我的值,则采用最高的行号,然后从中减去初始行号,并得到8。

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

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