google-sheetsgoogle-sheets-formula

Get highest occurring row number of key?


I'm making a google sheet to calculate ratings between teams that play against each other.

I know I can use the match function to get the index in a column from a key. I made a formula To find the most recent occurring row number of a match, but it looks like it doesn't necessarily return the latest row. How can I find the most recent (highest number) row where a key value occurs?

The googlesheet below shows my attempt. Screenshot added for convenience.

https://docs.google.com/spreadsheets/d/12TIYCNYvpmlsKpbcexKtTqE9KypPmOUx8hIdy_0WF2Q/edit?gid=0#gid=0

Incorrect row number


Solution

  • You may use xmatch search_mode -1 (-1 is to search from the last entry to the first)

    =ifna(xmatch(B19,$B$1:B18,,-1))
    

    enter image description here