Going Stellar

Home/Google Sheets reference

Google Sheets recipe

How to VLOOKUP from another sheet in Google Sheets

For another tab in the same file, write the tab name before the range: =VLOOKUP(key, Sheet1!A2:B4, 2, FALSE). For a different file, put IMPORTRANGE(file_id, "Sheet1!A2:B4") where the range goes.

Steps

  1. Note the exact tab name, for example Sheet1, and the range that holds the table, for example A2:B4.
  2. Write the lookup as usual and replace the range with TabName!Range: =VLOOKUP(B2, Sheet1!A2:B4, 2, FALSE).
  3. Write the range with dollar signs, as in the second example, if you plan to copy the formula down.
  4. Wrap in IFERROR to show your own text for keys that are not on the other tab.
  5. For a different file, replace the range with IMPORTRANGE("file_id", "Sheet1!A2:B4"). Until access to that file is allowed, the cell shows #REF!.

Examples

The examples use this table, starting in A1:

StoreCity
S1Iasi
S2Cluj
S3Oradea
=VLOOKUP("Iasi", Sheet1!A2:B4, 2, FALSE)

Result: 17

The tab name, an exclamation mark, then the range. The lookup table lives on Sheet1, the formula on another tab.

Run in a Google Sheet (English US locale) on .

=VLOOKUP(B2, Sheet1!$A$2:$B$4, 2, FALSE)

Result: 17

The key comes from a cell. The range of the other tab is written with dollar signs, as an absolute reference.

Run in a Google Sheet (English US locale) on .

=ARRAYFORMULA(VLOOKUP(B2:B3, Sheet1!A2:B4, 2, FALSE))

Result:

17
42

One formula for a whole column of keys: ARRAYFORMULA returns one result per key.

Run in a Google Sheet (English US locale) on .

=IFERROR(VLOOKUP(B4, Sheet1!A2:B4, 2, FALSE), "no data")

Result: no data

Oradea is not on Sheet1, so VLOOKUP gives #N/A and IFERROR shows your text instead.

Run in a Google Sheet (English US locale) on .

=VLOOKUP("Cluj", IMPORTRANGE("1l9m6VNhndPMXSx1F80hKNl4zeWRIBG8aj38weuYWP9A", "Sheet1!A2:B4"), 2, FALSE)

Result: 42

A table from another file: IMPORTRANGE brings the range in, VLOOKUP searches it. Here the source is the same file, so no permission is needed.

Run in a Google Sheet (English US locale) on . The result changes over time; this is the value on the run date.

Common errors

  • A tab name that does not exist, or one with a typo, returns #REF!. Copy the name exactly as it appears on the tab.
  • A key that is missing on the other tab returns #N/A. IFERROR hides it, but check the spelling first.
  • An index larger than the number of columns in the range returns #REF!, for example 3 on the two-column range A2:B4.
  • When access to a different source file has not been granted, IMPORTRANGE returns #REF! and VLOOKUP passes that error on.

Compared with Excel

A reference to another tab, such as Sheet1!A2:B4, is written the same way in Excel. IMPORTRANGE does not exist in Excel: there you link another workbook with a reference to that file.

Functions used

Sources

  1. VLOOKUP (Docs Editors Help)
  2. IMPORTRANGE (Docs Editors Help)
  3. IFERROR (Docs Editors Help)

Markdown version · All functions