查找第一个出现的数字的行索引 [英] find a row index of a number that occurred first
问题描述
我有 A
列,其中的值以随机顺序排列,例如
I have A
column that has values in random order like
A column
2
3
4
2
5
6
4
3
4
我想要第一个出现的特定数字的行索引.说如果我说数字是 4,则返回的值应该是 3
I want the row index of a particular number that occurred first. say if i say the number is 4 the value returned should be 3
我还想要最后出现的特定数字的行索引.如果我说数字是 3,那么返回的值必须是 8
I also want the row index of a particular number that occured last.say if i say the number is 3 then the value returned must be 8
我在想 Vlookup
或 find
函数必须完成任务,但无法将它们按顺序排列.请帮助我解决这些问题
I was thinking Vlookup
or find
function must do the task but unable to put them in order.please help me with these
推荐答案
我的示例正在寻找数字 3
但它很容易适应.
My examples are looking for the number 3
but it is easy to adapt.
要查找第一次出现,您可以使用:
To find the first occurence, you can use:
=MATCH(3,A:A,0)
要找到最后一个,您可以使用数组公式(使用Ctrl+Shift+Enter验证)
To find the last one, you can use an array formula (validate with Ctrl+Shift+Enter)
{=MAX(IF(A1:A10=3,ROW(A1:A10),0))}
请注意,您也可以使用带有 MIN
的第一个数组公式,但它的价值会非常复杂.
Note that you could also have used an array formula for the first one with a MIN
but it would be quite complicated for what it's worth.
这篇关于查找第一个出现的数字的行索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!