Search code examples
arraysif-statementgoogle-sheetsmaxrow

How to pull row number of the last row containing a specific text?


I want to pull the row number of the last row conataining a specific text and the data is sorted randomly in google sheet. For example, I need to return the row number for the text "John" and since "John" is repeating several times, I need the last row containing "John".

  1. Harry
  2. Sara
  3. John
  4. Harry
  5. Harry
  6. John

So for the above data which is in a single column, I want to return value 6.


Solution

  • try:

    =INDEX(MAX(ROW(A:A)*(A:A="John"))