find a row index of a number that occurred first

前端 未结 2 1505
长情又很酷
长情又很酷 2020-12-09 09:04

I have A column that has values in random order like

       A column
           2
           3
           4
           2
           5
                  


        
2条回答
  •  鱼传尺愫
    2020-12-09 10:02

    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.

提交回复
热议问题