How can I use VLOOKUP to return the last matching value in Excel? 2

How can I use VLOOKUP to return the last matching value in Excel?

VLOOKUP is a powerful function in Excel that allows users to search for specific values in a table and return corresponding information. One useful application of this function is using it to find the last matching value in a table. To do this, the VLOOKUP formula must be combined with other functions such as MAX and COUNTIF. By using these functions together, the VLOOKUP formula can be set to search for the maximum value in a specified range, then use the COUNTIF function to count the number of times that value appears in the table. The result of this calculation can then be used as the lookup value in the VLOOKUP formula, returning the last matching value in the table. This can be helpful in situations where the data in the table is constantly changing and the user needs to find the most recent or updated information. By understanding how to use VLOOKUP in this way, users can efficiently retrieve the last matching value in Excel.

Excel: Use VLOOKUP to Return Last Matching Value


By default, the VLOOKUP function in Excel looks up some value in a range and returns a corresponding value for the first match.

However, sometimes you may want to look up a value in a range and return the corresponding value for the last match.

The easiest way to do this in Excel is by using the following basic syntax with the LOOKUP function:

=LOOKUP(2,1/($A$2:$A$12=F1),$C$2:$C$12)

This particular formula finds the last value in the range A2:A12 that is equal to the value in cell F1 and  returns the corresponding value in the range C2:C12.

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

Example: Look Up Value in Excel and Return Last Matching Value

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

Suppose we would like to look up the team name “Nets” and return the value in the points column for the last player who is on the Nets team.

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

=LOOKUP(2,1/($A$2:$A$12=F1),$C$2:$C$12)

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

Excel VLOOKUP return last matching value

The formula returns a value of 29.

By looking at the data, we can confirm that this is indeed the points value that corresponds to the last player on the “Nets” team:

For example, suppose we change the team name to Warriors:

The formula returns a value of 12, which is the points value that corresponds to the last player on the Warriors” team.

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

Cite this article

stats writer (2024). How can I use VLOOKUP to return the last matching value in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-vlookup-to-return-the-last-matching-value-in-excel/

stats writer. "How can I use VLOOKUP to return the last matching value in Excel?." PSYCHOLOGICAL SCALES, 22 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-vlookup-to-return-the-last-matching-value-in-excel/.

stats writer. "How can I use VLOOKUP to return the last matching value in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-vlookup-to-return-the-last-matching-value-in-excel/.

stats writer (2024) 'How can I use VLOOKUP to return the last matching value in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-vlookup-to-return-the-last-matching-value-in-excel/.

[1] stats writer, "How can I use VLOOKUP to return the last matching value in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use VLOOKUP to return the last matching value in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top