A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
You could try this array-entered****** formula (obviously change the ranges to match your actual data)...
=INDEX(A:A,MAX(IF(B2:G4="XXX",ROW(B2:G4))))
******Commit this formula using CTRL+SHIFT+ENTER and not just Enter by itself