HomeGoogle DocsSpreadsheetHow to Lookup Latest Dates in Google Sheets

How to Lookup Latest Dates in Google Sheets [Array Formula]

Published on

With the help of a Vlookup Array Formula, you can lookup latest dates in Google Sheets.

Suppose in a column I have a list of different items and the items may repeat many times based on their availability dates.

In a second column, I’ve filled the different availability of each item. As I’ve mentioned, each item has multiple availability dates. So I want to list out the items with latest delivery dates.

The Main function that I’m going to use here is Vlookup. But in the Vlookup we should replace the lookup range, I mean the data rage, with a virtual data range. This virtual data range is the output of SORT and SORTN combination formula.

Example:

Suppose I have ordered Sunglasses of different brands and it’s in Column A of my spreadsheet.

In Column B, I’ve updated the availability dates of these products. Each item has multiple availability dates and I want to lookup latest available dates of each item.

How to Lookup latest dates in Google Sheets?

What we want to do is lookup column A for Sunglasses and return the latest availability dates from Column B.

How to Lookup Latest Dates in Google Sheets

Steps:

Here are the tips to lookup latest dates in Google Sheets.

1. First sort the column B in descending order. So the items with the latest dates will be on top. No doubt, we can use the function SORT here.

2. Remove all the second, third or multiple occurrences of each item. So the items with the latest dates will be only left. The suitable function here is SORTN.

3. Finally, we can use the result of the second formula as lookup range in Vlookup.

Hope you have got some idea and the logic. Now here is that formula to lookup latest dates in Google Sheets. Please enter this formula in cell F2.

Array Formula to Lookup Latest Dates in Google Sheets

=ArrayFormula(VLOOKUP(E2:E5,SORTN(SORT(A2:B9,2,FALSE,1,TRUE),20,2,1,TRUE),2,FALSE))

Formula Explanation

lookup latest dates - formula explanation

First, let me begin with the role of SORT (in the Red color font) in this formula. The below is the output of SORT.

Sort descending order to find latest dates

We can take only one item from this as an example.

See the item Sunglasses 1 and its available dates. After the sorting in descending order, the latest dated one is on the top. It’s applicable to all items.

Now if we can remove the second occurrences of all the items, the balance available items are the items with the latest dates. We can use SORTN for this purpose.

In the above formula, I’ve highlighted the SORTN with light Yellow color. The output of the SORTN formula would be as below.

remove duplicates using SORTN and list out latest dates

SORTN removed all the duplicates and now the only data left is the items with latest available dates.

Must Check: Pick SORTN from my Google Sheets Function Guide

Actually, in most of the cases, this data is enough. But if you want you can use Vlookup to lookup items with the latest dates.

Vlookup looks up latest dates in array

In column E, you can see the lookup values. At present, I’ve put all the items in there. You can limit it to only one item, two items or all the items that you want to look up. The formula and the formula range will remain the same.

Conclusion

With the above tips, you can lookup latest dates in Google Sheets. To lookup earliest dates, I’ve another tutorial on that. Actually the only changes there is in the SORT order.

Similar Topic: Lookup Earliest Dates in Google Sheets in a List of Items

In the real sense, on contrary to my statement in the first para, SORTN is the soul of this formula, not Vlookup.

Of course, Vlookup is a must for lookup dates. But without SORTN Vlookup may not be able to lookup earliest dates.

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.

Running Total By Month in Excel

This tutorial demonstrates how to calculate the running total by month in a range...

SORT and SORTBY – Excel Vs Google Sheets

While Excel offers the SORT and SORTBY functions for sorting a table, Google Sheets...

Get Top N Values Using Excel’s FILTER Function

When using the FILTER function in Excel to extract the top N values, it's...

XLOOKUP in Excel: Working with Visible Rows in a Table

In Excel, the XLOOKUP function isn't inherently designed to exclusively work with visible rows;...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

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.