Excel: How to Find Last Instance of Matching Value


You can use the following formula to return the last instance of a matching value in Excel:

=INDEX(B2:B11,SUMPRODUCT(MAX(ROW(A2:A11)*(F1=A2:A11))-1))

This particular formula will look up the value in cell F1 in the range A2:A11 and then return the value from the range B2:B11 that corresponds to the last instance of the matching value.

The following example shows how to use this formula in practice.

Example: Find Last Instance of Matching Value in Excel

Suppose we have the following dataset in Excel that contains information about various basketball players:

Suppose we would like to return the value in the points column that corresponds to the last instance of “Mavs” in the team column.

We can type the following formula into cell F2 to do so:

=INDEX(B2:B11,SUMPRODUCT(MAX(ROW(A2:A11)*(F1=A2:A11))-1))

The following screenshot shows how to use this formula in practice:

Excel match last instance

The formula returns a value of 15, which is the value in the points column that corresponds to the last instance of “Mavs” in the team column.

If we would like to return the value in the assists column instead, we could change the cell range B1:B11 to C1:C11:

=INDEX(C2:C11,SUMPRODUCT(MAX(ROW(A2:A11)*(F1=A2:A11))-1))

The following screenshot shows how to use this formula in practice:

The formula returns a value of 9, which is the value in the assists column that corresponds to the second instance of “Mavs” in the team column.

Additional Resources

The following tutorials explain how to perform other common tasks in Excel:

Excel: Count Number of Matches Between Two Columns
Excel: How to Find All Values that Match Criteria
Excel: How to Find Matching Values in Two Worksheets

Leave a Reply

Your email address will not be published. Required fields are marked *