keepcalculator

06 Numbers and Powers

Look Up an Entire Column in Excel or Google Sheets

Card No. 06·36158 · Updated · Standard formula, shown below

To look up a value anywhere in an entire spreadsheet column, use a lookup formula that searches the column and returns the matching result from another column. In Excel or Google Sheets, XLOOKUP is the clearest option when available; VLOOKUP, INDEX with MATCH, or a filter can handle other needs.

What “look up an entire column” means

The phrase can mean either searching all the cells in one column for a value or using a whole column as the lookup range. For example, a product list might have product codes in column A and descriptions in column B. A formula can search column A for a code and return its description from column B.

Spreadsheet formulas do not usually need a special “entire column lookup” command. You refer to a whole column with a reference such as A:A, or use a bounded range such as A2:A1000. The right choice depends on the formula, the spreadsheet application, and the size of the data.

Use XLOOKUP for a direct match

When available, XLOOKUP makes the relationship between the search range and result range explicit. In Excel or Google Sheets, a basic exact-match formula is:

=XLOOKUP(E2,A:A,B:B,"Not found")

This searches for the value in E2 throughout column A and returns the value from the corresponding row in column B. If there is no match, it displays “Not found.” XLOOKUP uses exact match by default, so it is generally a good fit for IDs, names, and other values that must match precisely.

For example, if E2 contains P-104, and cell A27 contains P-104, the formula returns the value in B27. It returns the first matching result it encounters. If the lookup and return columns are reversed, XLOOKUP can still work: the lookup range and return range can be in either order.

In Excel versions without XLOOKUP, use one of the alternatives below. Spreadsheet features can vary by application and version, so if a formula returns an unknown-function error, check whether that function is supported in the version being used.

Use VLOOKUP when the result is to the right

VLOOKUP is widely supported and searches the first column of a table range, returning a value from a specified column to its right:

=VLOOKUP(E2,A:B,2,FALSE)

Here, E2 is the value to find, A:B is the search table, and 2 tells the formula to return the second column of that table. The final argument, FALSE, requests an exact match. Include it for IDs and other exact lookups; leaving it out or using TRUE can lead to approximate-match behavior that is unsuitable for many lists.

VLOOKUP has an important limitation: the lookup column must be the first column in the selected table range, and the result must be to its right. If codes are in column B and the desired result is in column A, use XLOOKUP or INDEX with MATCH instead.

Use INDEX and MATCH for flexible lookups

INDEX and MATCH work together in Excel and Google Sheets. MATCH finds the position of a value in a range, while INDEX returns the value at the corresponding position in another range:

=INDEX(B:B,MATCH(E2,A:A,0))

The zero in MATCH requests an exact match. This approach can return values from a column to the left or right of the lookup column and is useful in spreadsheets that do not support XLOOKUP. If the value is missing, MATCH returns an error; wrap the expression in IFERROR if a friendly message is preferable:

=IFERROR(INDEX(B:B,MATCH(E2,A:A,0)),"Not found")

Use error handling thoughtfully. A message such as “Not found” can make a report easier to read, but it may also hide other problems in a formula. During troubleshooting, temporarily remove IFERROR to see the underlying error.

Whole-column references and performance

References such as A:A are convenient because new entries in the column are included automatically. They can also make formulas easier to maintain when the list grows. However, a formula that repeatedly processes many full columns may calculate more slowly, especially in a large workbook with many formulas.

If the data has a known size, use a reasonable range, such as A2:A5000 and B2:B5000, rather than searching every row. The search and return ranges should have matching heights; otherwise, formulas may return errors or results that do not align as intended. In Excel, structured table references can be an easier-to-maintain alternative because they expand as rows are added.

  • Use whole-column references for simple, manageable sheets where automatic expansion is useful.
  • Use bounded ranges or table references in larger workbooks with many calculations.
  • Keep the lookup range and return range aligned to the same rows.
  • Use exact-match settings for identifiers, codes, and names unless approximate matching is intentional.

Common problems and how to fix them

A formula that says “Not found” may be working correctly: the requested value might not exist. If it should exist, check for leading or trailing spaces, different punctuation, or text-versus-number mismatches. For instance, a number stored as text may not match the same digits stored as a numeric value. Formatting a cell to look like a number does not necessarily change the underlying value.

Duplicate lookup values are another frequent source of confusion. XLOOKUP, VLOOKUP, and INDEX with MATCH typically return the first match, not every matching row. If the goal is to show all matching records, use a filter or a function designed to return multiple results, such as FILTER where supported.

Also check that the formula points at the intended columns. In VLOOKUP, the column number is counted from the start of the table range, not from the worksheet’s column A. In INDEX/MATCH, the lookup and return ranges need to cover corresponding rows.

When a filter is better than a lookup

A lookup is best when one matching value is needed in a particular cell. A filter is more appropriate when the reader wants to see every row that meets a condition. For example, a product code might appear on several order rows; a single lookup usually returns one of them, while a filter can display all orders with that code.

In Google Sheets or modern Excel, a formula such as =FILTER(A:B,A:A=E2) returns rows from columns A and B where column A equals E2, subject to the spreadsheet’s supported syntax and available results space. A built-in filter can do the same interactively without writing a formula.

Frequently Asked Questions

How do I search an entire column in Excel?
Use a lookup formula with a whole-column range, such as =XLOOKUP(E2,A:A,B:B,"Not found"). For older Excel versions, use VLOOKUP or INDEX with MATCH.

Can VLOOKUP search an entire column?
Yes. A reference such as A:B can be used as its table range, but VLOOKUP searches only the table’s first column and returns a value from a column to its right.

Why does my lookup say the value is not found?
Check for extra spaces, inconsistent spelling, and numbers stored as text in one place but as numbers in another. Confirm that the formula is searching the correct column and using an exact match where appropriate.

How do I return all matches instead of the first one?
Use FILTER or a spreadsheet’s filter feature rather than a single-result lookup. A standard XLOOKUP or VLOOKUP generally returns only one matching row.

Is it better to use A:A or a limited range?
A:A is convenient when the list changes size. A bounded range or table reference may be more efficient in a large workbook with many formulas.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →