HomeGoogle DocsSpreadsheetThree-way Lookup in Google Sheets

Three-way Lookup in Google Sheets [Array and Non-Array Formulas]

Published on

In three-way lookup, there will be three search keys. Two from two columns and one from a row. To do a three-way lookup in Google Sheets, I am ‘only’ using the functions Vlookup and Match. Also, the use of the ampersand sign or Concatenate function is a must.

As a bonus I’ll try to provide you a three way lookup array formula too.

If I may use Index-Match, the popular three-way lookup solution among Excel users, I might not be able to generate a 3-way array lookup.

Here we go!

As an example, you can take a General Ledger (GL) Data (mock data) of a company.

Three-way Lookup in Google Sheets

Lookup the company “1000” and Account “11003” in column A and B respectively (vertical Lookup). Then Lookup the month “Mar” in row # 1 (horizontal Lookup).

The end result would be the value $114,514.00 that available in the cell E4.

Non-Array Formula to Perform Three-way Lookup in Google Sheets

First, let me provide you the three-way lookup formula that works in Google Sheets. This formula may not expand (non-array) the results to additional rows/columns.

=ArrayFormula(vlookup(1000&11003,{A1:A&B1:B,C1:F},match("Mar",A1:F1,0)-1,0))

This is similar to my two-way Lookup formula. The only change is in the use of the vertical Lookup search keys.

The search keys are combined using the ampersand as well as the columns A and B.

Google Sheets 3-way Lookup Formula Explanation

Some important points about the Google Sheets Vlookup function that can help you to change your mindset in the use of this trendy function.

The VLOOKUP is set to use the search key in the first column in the range. But there is flexibility in this.

For example, in the above GL data (range A1:F), the first search key, i.e. “1000”, is in the column A. The second search key, i.e “11003”, is in column B.

The logic here is, combine the two search keys using the ampersand as well as the columns A and B in the GL data. So ultimately there will be one search key and one search column (no second column).

The combined search key:

1000&11003

The combined columns in GL data:

{A1:A&B1:B,C1:F}

Yes! Instead of A1:F we are using a virtual range as above. Now the third search key is “Mar” which is the month in row # 1.

What we want is to dynamcialy return the index column in Vlookup using the search key.

match("Mar",A1:F1,0)-1

The above formula returns # 4. Actually, the column that contains the March month data is in column E, the fifth column.

Since I have combined the column A and B, the column number of column E in the above three-way lookup formula is 4 not, 5. The -1 in the above Match formula deals that.

This is the easiest formula to do a three-way Lookup in Google Sheets.

Array Formula for Three-way Lookup in Google Sheets

Multiple row output in 3-way Lookup is pretty easy if you could understand the above non-array 3-way Lookup formula.

I have highlighted the multiple column search keys, row search key (to find index number) and the outputs.

Formula:

=ArrayFormula(vlookup({1000&11003;1002&11002},{A1:A&B1:B,C1:F},match("Mar",A1:F1,0)-1,0))
Three-way Lookup Array Formula in Google Sheets

When you compare this formula with the non-array formula, you can understand that the change is in the search key usage.

See the underlined search keys in cyan and red color not only in the formula bar but also in the column A and B.

Finally I must explain how to take the criteria from cells.

Formula (in cell J2):

=ArrayFormula(vlookup(H2:H3&I2:I3,{A1:A&B1:B,C1:F},match(J1,A1:F1,0)-1,0))
Three-way Lookup Demo in Sheets

That’s all. Hope you may share your thoughts on three-way Lookup in Google Sheets. Enjoy!

More Vlookup Resources:

  1. Vlookup from Bottom to Top in Google Docs Sheets.
  2. Vlookup Result Plus Next ‘n’ Rows in Google Sheets.
  3. Create Hyperlink to Vlookup Output Cell in Google Sheets.
  4. Vlookup Skips Hidden Rows in Google Sheets – Formula Example.
  5. How to Vlookup Importrange in Google Sheets [Formula Examples].
  6. Comparison of Vlookup Formula in Excel and Google Sheets.
  7. How to Vlookup a Date Range in Google Sheets [Sorted/Unsorted Data].
  8. How to Highlight Vlookup Result Value in Google Sheets.
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.

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

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...

More like this

Creating Sequential Dates in Equally Merged Cells in Google Sheets

Do you know how to create sequential dates in equally merged cells across a...

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...

2 COMMENTS

  1. As always, even on your busy day, you still managed to help me with my sheet with your advanced formula.
    Thanks Prashant 😊

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.