Vlookup to Return Only Values from Max Rows in Google Sheets

Find here all that you want to know about Vlookup in Max Rows in Google Sheets. You can tune the Vlookup to return only values from Max Rows in Google Sheets.

Lots of spreadsheet-related tasks require Vlookup in one way or another. So learning this function in its all possible variations will give you an upper hand in data manipulation.

Let us come back to our topic, i.e., Vlookup in Max Rows in Google Sheets. I am considering the below points in this Google Sheets tutorial.

  1. Find max value in a column and return value from the next column.
  2. Lookup a search key (possibly a string) and return the max value or value from the max row. That means the search key will be in the table multiple times. We only want the max value or any other value from the max value row of this key.
  3. How to use multiple search keys and return multiple max values or multiple values from the max row?

In concise, this tutorial is all about Max in Vlookup in Google Sheets. So here we go.

All About Vlookup in Max Rows in Google Sheets

Learn how to use Vlookup to return only values from the max rows in Google Sheets. You can learn this Vlookup Max concept under different subcategories below.

Find Max Value and Return Value from the Next | Adjoining Column

For this type of lookup, you can use the MAX function with Vlookup. Instead of feeding a search key directly in Vlookup, let the MAX return the max value as the search key.

=vlookup(max(A2:A9),A2:B9,2,0)
max value as the search key in Vlookup

In most cases, your column that contains the max value will be second, third, or fourth.

If so, you can flip the columns using the ArrayFormula in Vlookup. As you may know, the Vlookup in Sheets can only search down the first column for the key.

Assume in your Sheets, the name column is the first column, and the Score column is the second. Then use the formula as below.

=ArrayFormula(vlookup(max(B2:B9),{B2:B9,A2:A9},2,0))

So you have just learned the basics of using MAX in Vlookup in Google Sheets.

We are discussing how to use Vlookup in Max Rows in Google Sheets. Here is the second tip.

You May Like: Find Min, Max in a Matrix and Return a Value from the Same Row.

Lookup a Search Key and Return the Max Value or Value from the Max Value Row

Here the search key is not the max value.

This time you have the search key (text string) to search down the first column.

But the first column may or may not contain the search key multiple times.

How to return the max value or any other value of the search key from the row that contains the max value?

=vlookup("Student 2",sort(A2:B9,2,false),2,false)
search and find max value using Vlookup

I have used the SORT function with Vlookup here.

Without using SORT, the Vlookup formula would return the value 550 that is in cell B5. Because the search key “Student 2” is first appearing in that row.

I have sorted the data range in descending order based on column 2.

It puts the max values on the top. So, the max value row # 6 will be on top of the current row #5.

Here also you can flip the columns in Vlookup as we have done in example # 1 above.

Here is another notable point.

If you want to look up a search key and return value from any column from the Max row, you only need to change the column index in the formula.

For example, I have a three-column dataset that contains;

Student names in the first column, scores in the second column, and random dates in the third column.

You can return the date corresponding to the max score of the search key as below.

=vlookup("Student 2",sort(A2:B9,2,false),3,false)

Now see one advanced Max Value in Vlookup tip. Here I am following the above Vlookup max example.

The only difference is in the use of multiple search keys.

Vlookup to Only Return Values from Max Rows in Sheets (Multiple Search Keys)

See this example. You can use the just above formula with some changes.

What are those changes?

E.g.:-

=ArrayFormula(vlookup(E2:E4,sort(A2:C10,2,false),2,false))
Vlookup to Only Return Values from Max Rows

This formula may look complex, but it is simple to understand.

Multiple Max in Vlookup – Formula Logic

Here we have the Vlookup search keys in the range E2:E4, and that is the student names.

What we want is their max scores in Column B.

As we have done earlier, sort the ‘Score 1’ column B in descending order within the Vlookup.

Use the search key as a range E2:E4 instead of “Student 2” in the earlier formula.

Further, use the ArrayFormula as we want an array result.

Vlookup Alternative to Return Values from Max Rows (Using SORT + SORTN)

In Vlookup we have used the SORT to sort the ‘Score 1’ column in descending order. It places the higher scores on the top.

sort higher scores in sortn

Now take a look at column A.

If you can remove the duplicates, I mean the second and third occurrences of the same student names, then the three student names and their max scores will only be left.

In this workaround, I have wrapped that SORT formula with the SORTN as below.

=sortn(sort(A2:C10,2,false),9^9,2,1,true)

Note:- Unlike Vlookup, there is no need to specify the criteria separately.

The SORTN removes the duplicates based on the Student names. Want to know the parameters used in SORTN above.

  • 9^9 – You can replace this with 1000 or any large number as its role is ‘n’ (infinite).
  • 2 = it’s the display_ties_mode in SORTN.
  • 1 – sort column (the column to unique).
  • true – sort order.

Must Read: Remove Duplicates in Google Sheets [The Complete Guide and Sample Sheet]

I mean, the SORTN + SORT combo alone would return the below result, and that’s the max rows! This tip is entirely new to you, right?

Student 150127/07/2018
Student 258027/07/2018
Student 354027/07/2018

That’s all about Max in Vlookup in Google Sheets. Enjoy!

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Compare Two Tables for Differences in Excel

To compare two tables with similar data for differences, you can use the XLOOKUP...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

More like this

Highlight Upcoming Birthdays in Google Sheets

When highlighting upcoming birthdays in Google Sheets, one important aspect is ignoring the year...

Calculate Weighted Average in Pivot Table in Google Sheets

You can calculate a weighted average in a Pivot Table using a custom formula...

Summarize Data and Keep the Last Record in Google Sheets

In Google Sheets, we can summarize data (like sum, average, min, max, count) using...

4 COMMENTS

  1. What if I needed the same (Return Values from Max Rows) but for unique First Name + Last Name combinations?
    This way, I would have John Doe1, John Doe2, Robert Doe2, each of which is a unique student I need to obtain the max score.
    How will the Vlookup formula change?
    Array A2:B (where A = student’s first name, B = student’s last name) doesn’t seem to work.

    • Hi, Maksym Mukhin,

      Range A2:C.

      A2:A – First Name (text string)
      B2:B – Last Name (text string)
      C2:C – Score (numeric)

      Formula # 1:

      =vlookup("John Doe1",sort({A2:A&" "&B2:B,C2:C},2,false),2,false)

      Formula # 2:

      To return a table.

      =sortn(sort(A2:C,1,1,2,1,3,0),9^9,2,index(sort(A2:C,1,1,2,1,3,0),0,1)&
      index(sort(A2:C,1,1,2,1,3,0),0,2),0)

    • Hi, Harry,

      Replace Max with Min. Also wherever I have used SORT, instead of sorting in descending (false) order, sort the column2 in ascending order (true).

      Best,

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.