Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
682 views
in Technique[技术] by (71.8m points)

excel - find a row index of a number that occurred first

I have A column that has values in random order like

       A column
           2
           3
           4
           2
           5
           6
           4
           3
           4

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

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

I was thinking Vlookup or find function must do the task but unable to put them in order.please help me with these

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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)

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))}

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...