HumanSoft โปรแกรม HR
Published: November 25, 20261 views
Date Modified: November 24, 2026
General Knowledge
10 Excel Lookup Formulas for Work - blog image preview
Blog>10 Excel Lookup Formulas for Work

10 Excel Lookup Formulas for Work, from VLOOKUP to XLOOKUP 

Ten commonly used Excel formulas for finding data are VLOOKUP, HLOOKUP, XLOOKUP, INDEX + MATCH, MATCH, XMATCH, LOOKUP, FILTER, IFERROR, and COUNTIF. If you use Excel 2021 or later or Microsoft 365, start with XLOOKUP. It can return values to the left or right of the lookup column and display a custom message if it finds no match.

 

Table of Contents:

What Are the 10 Excel Lookup Formulas?

Most examples in this article use an employee table with these columns: A Employee ID · B Name · C Department · D Job Title · E Salary (rows 2–100). Enter the employee ID you want to find in cell G2.

 

Formula

What It Does

Example Formula

Excel Compatibility

VLOOKUP

Looks up a value in the leftmost column and returns a value from a column to its right.

=VLOOKUP(G2,A2:E100,5,FALSE)

All versions

HLOOKUP

Looks up a value in the top row and returns a value from a row below it.

=HLOOKUP("มี.ค.",B1:M3,2,FALSE)

All versions

XLOOKUP

Looks up values in any direction and lets you set a message for missing matches.

=XLOOKUP(G2,A2:A100,E2:E100,"ไม่พบ")

2021 · Microsoft 365 · Excel for the web

INDEX + MATCH

Looks up values in any direction in older versions of Excel.

=INDEX(E2:E100,MATCH(G2,A2:A100,0))

All versions

MATCH

Returns the position of a lookup value within a range.

=MATCH("เงินเดือน",A1:E1,0)

All versions

XMATCH

Returns a position like MATCH and can also search from bottom to top.

=XMATCH(G2,A2:A100,0,-1)

2021 · Microsoft 365 · Excel for the web

LOOKUP

Looks up a value in an ascending range, which is useful for finding score bands.

=LOOKUP(G2,J2:J6,K2:K6)

All versions

FILTER

Returns all rows that meet a condition.

=FILTER(A2:E100,C2:C100="บัญชี","ไม่พบ")

2021 · Microsoft 365 · Excel for the web

IFERROR

Replaces errors from a lookup formula with a readable message.

=IFERROR(VLOOKUP(G2,A2:E100,5,FALSE),"ไม่พบ")

All versions

COUNTIF

Checks whether a value exists and counts how many times it appears.

=COUNTIF(A2:A100,G2)

All versions

 

How Do You Use Each Excel Lookup Formula?

Each formula includes when to use it, its syntax, an example, the result, and tips.

1. VLOOKUP

When to use: You know an ID or name and want to retrieve another value from the same row. For example, enter an employee ID to display the employee's salary.

Syntax: =VLOOKUP(ค่าที่ต้องการค้น, ตารางข้อมูล, ลำดับคอลัมน์ที่ต้องการ, FALSE)

Example: =VLOOKUP(G2, A2:E100, 5, FALSE)

Result: Excel looks for the ID in G2 in column A and returns the salary from the fifth column of the table (column E).

Tips

  • The lookup value must be in the first column of the selected table.

  • Use FALSE as the final argument to find an exact match.

  • If you insert a column in the table, update the column index in the formula manually.

 

2. HLOOKUP

When to use: Your table is arranged horizontally, with headings such as month names in the top row and the corresponding data in the rows below.

Syntax: =HLOOKUP(ค่าที่ต้องการค้น, ตารางข้อมูล, ลำดับแถวที่ต้องการ, FALSE)

Example: =HLOOKUP("มี.ค.", B1:M3, 2, FALSE)

Result: Excel finds the March label in the top row and returns the value from the second row of that column, such as total overtime hours for March.

Tips

  • The lookup value must be in the first row of the selected table.

  • In Excel 2021 or later and Microsoft 365, you can use XLOOKUP for horizontal lookups.

 

3. XLOOKUP

When to use: You want a lookup like VLOOKUP, but the value you need is to the left, or you want to display a message if there is no match.

Syntax: =XLOOKUP(ค่าที่ต้องการค้น, คอลัมน์ที่ใช้ค้น, คอลัมน์ผลลัพธ์, "ข้อความเมื่อหาไม่เจอ")

Example: =XLOOKUP(G2, A2:A100, E2:E100, "ไม่พบรหัสนี้")

Result: The formula returns the salary for the ID in G2. If the ID is missing from the table, it displays "ไม่พบรหัสนี้" (ID not found).

Tips

  • XLOOKUP can return a value from the left. For example, =XLOOKUP(G3, B2:B100, A2:A100) looks for the name in G3 and returns the employee ID from the column to its left.

  • XLOOKUP finds an exact match by default, so FALSE is unnecessary.

  • There are two optional arguments at the end. The fifth sets the match mode, such as approximate or wildcard matching with *. The sixth lets you search from bottom to top.

  • Available in Excel 2021 or later (including Excel 2024), Microsoft 365, and Excel for the web.

 

4. INDEX + MATCH

When to use: You want a lookup like XLOOKUP and need the workbook to open in Excel 2016 or 2019.

Syntax: =INDEX(คอลัมน์ผลลัพธ์, MATCH(ค่าที่ต้องการค้น, คอลัมน์ที่ใช้ค้น, 0))

Example: =INDEX(E2:E100, MATCH(G2, A2:A100, 0))

Result: MATCH finds the position of the ID in G2, and INDEX returns the salary from that position. The result is the same as in the VLOOKUP example.

Tips

  • You can return values from the left because the lookup and return columns are specified separately.

  • The formula continues to work if you insert or delete columns.

  • Use 0 in MATCH for an exact match.

 

5. MATCH

When to use: You want to find the position of a value. MATCH returns a position, so it is often paired with another function to retrieve data.

Syntax: =MATCH(ค่าที่ต้องการค้น, ช่วงที่ใช้ค้น, 0)

Example: =MATCH("เงินเดือน", A1:E1, 0)

Result: The formula returns 5 because the salary heading ("เงินเดือน") is in the fifth position.

Tips

  • Use MATCH to supply the column index in VLOOKUP. For example, =VLOOKUP(G2, A2:E100, MATCH("เงินเดือน", A1:E1, 0), FALSE) still returns the correct result if you move the column.

  • Use 0 to find an exact match. If you omit it, Excel finds the largest value less than or equal to the lookup value. The data must be sorted in ascending order, or Excel may return an incorrect result without displaying an error.

 

6. XMATCH

When to use: You want to find a position as with MATCH and search from bottom to top, such as to locate an employee's latest entry in a history table.

Syntax: =XMATCH(ค่าที่ต้องการค้น, ช่วงที่ใช้ค้น, 0, -1)

Example: =XMATCH(G2, A2:A100, 0, -1)

Result: The formula returns the position of the last occurrence of the ID in G2. Positions are still counted from top to bottom. For example, 57 means the 57th item in A2:A100, which is row 58 on the worksheet.

Tips

  • Use -1 as the final argument to start at the last row and work upward. If you omit it, the search starts at the top.

  • XMATCH uses exact matching by default, whereas MATCH requires you to specify it.

  • Available in Excel 2021 or later (including Excel 2024), Microsoft 365, and Excel for the web.

 

7. LOOKUP

When to use: You want to determine which band a value falls into, such as the grade associated with a performance score.

Syntax: =LOOKUP(ค่าที่ต้องการค้น, ช่วงค่าขั้นต่ำ, ช่วงผลลัพธ์)

Example: =LOOKUP(H2, J2:J6, K2:K6)

Result: If J2:J6 contains the minimum scores 0, 60, 70, 80, and 90 and K2:K6 contains the grades D, C, B, A, and A+, a score of 75 in H2 returns a B because 75 falls in the 70–79 band.

Tips

  • Sort the minimum values in ascending order.

  • Use XLOOKUP or VLOOKUP to find an exact match for an ID.

 

8. FILTER

When to use: You want every row that meets a condition, such as the names of all employees in a department.

Syntax: =FILTER(ข้อมูลที่ต้องการแสดง, เงื่อนไข, "ข้อความเมื่อไม่พบ")

Example: =FILTER(A2:E100, C2:C100="บัญชี", "ไม่พบ")

Result: The formula returns every row and column for employees in the Accounting department.

Tips

  • Use * to combine conditions. For example, =FILTER(A2:E100, (C2:C100="บัญชี")*(E2:E100>30000)) returns employees in the Accounting department who earn more than THB 30,000.

  • Results spill into the cells below. Leave those cells empty to avoid a #SPILL! error.

  • Available in Excel 2021 or later (including Excel 2024), Microsoft 365, and Excel for the web.

 

9. IFERROR

When to use: You want to avoid displaying #N/A when Excel finds no match.

Syntax: =IFERROR(สูตรค้นหา, "ข้อความที่จะแสดงแทน")

Example: =IFERROR(VLOOKUP(G2, A2:E100, 5, FALSE), "ไม่พบรหัส")

Result: If the ID in G2 is missing, the formula displays "ไม่พบรหัส" (ID not found) in place of #N/A.

Tips

  • IFERROR catches every type of error, including typos in formulas. Check that the original formula works before wrapping it in IFERROR.

  • Use IFNA to handle only cases where a match is unavailable.

 

10. COUNTIF

When to use: You want to check whether a value exists or whether an ID appears more than once.

Syntax: =COUNTIF(ช่วงที่ต้องการนับ, ค่าที่ต้องการนับ)

Example: =COUNTIF(A2:A100, G2)

Result: A result of 0 means the ID is missing, 1 means it appears in one row, and anything above 1 means the ID is duplicated.

Tips

  • To find duplicate IDs across the table, enter =COUNTIF($A$2:$A$100, A2)>1  in an empty column and fill down. TRUE identifies rows with duplicate IDs. The $ signs keep the range fixed as you fill down.

  • If an ID appears more than once, the lookup formula returns data from the first matching row it finds.

 

How Do VLOOKUP and XLOOKUP Differ?

If you use Excel 2021 or later or Microsoft 365, choose XLOOKUP. It can do everything VLOOKUP does and is easier to write.

 

Question

VLOOKUP

XLOOKUP

Can it return values to the left?

Only values to the right

Yes, in either direction

How do you specify the return column?

Enter the column index, such as 5.

Select the return range directly, such as E2:E100.

Do you need to enter FALSE?

Yes, for an exact match.

No.

What happens if there is no match?

It returns #N/A. Use IFERROR to handle it.

You can set a custom message in the formula.

Do inserted columns affect the formula?

The column index may point to the wrong column.

The formula still works.

Can it search from bottom to top?

No.

Yes. Enter -1 as the final argument.

Which versions of Excel support it?

All versions

Excel 2021 or later · Microsoft 365 · Excel for the web

 

If you need to share the workbook with someone using Excel 2016 or 2019, use INDEX + MATCH in place of XLOOKUP. It returns the same result and works in all versions.

 

How Do You Fix #N/A and #REF! Lookup Errors?

#N/A means the formula could not find the lookup value. #REF! means the formula refers to a cell or column that does not exist.

Error

Cause

Fix

#N/A

The lookup value is missing from the table.

Check with COUNTIF first. Then wrap the formula in IFERROR or add a message as the fourth argument of XLOOKUP.

#N/A

The text has extra leading or trailing spaces, such as "E001 ".

Remove the extra spaces with TRIM, as in =VLOOKUP(TRIM(G2), A2:E100, 5, FALSE).

#N/A

Numbers are stored as text in one table and as numbers in the other.

Use Text to Columns or VALUE to convert them to the same data type.

#REF!

The VLOOKUP column index exceeds the number of columns in the selected range.

Select a wider range or change the column index so it falls within the selected range.

#REF!

A column, row, or worksheet referenced by the formula was deleted.

Press Ctrl+Z immediately or update the range reference in the formula.

 

10 Excel Lookup Formulas to Know for Work

The lookup formulas to know for work are VLOOKUP, HLOOKUP, XLOOKUP, INDEX + MATCH, MATCH, XMATCH, LOOKUP, FILTER, IFERROR, and COUNTIF. Use XLOOKUP as your default in Excel 2021 or later or Microsoft 365. Use INDEX + MATCH when working with older versions and FILTER when you want all matching rows.  Use IFERROR to handle missing matches and COUNTIF to check for duplicates.

 

Frequently Asked Questions About Excel Formulas

Can VLOOKUP retrieve data from another worksheet?

Yes. Put the worksheet name and an exclamation mark (!) before the range, as in =VLOOKUP(G2, พนักงาน!A2:E100, 5, FALSE). If the worksheet name contains a space, enclose it in single quotes, as in 'ข้อมูล พนักงาน'!A2:E100.

 

Can VLOOKUP return values to the left?

VLOOKUP returns values only from columns to the right of the lookup column. To return a value from the left, use XLOOKUP or INDEX + MATCH.

 

Can you use these formulas in Google Sheets?

Yes, all 10 formulas are available. In Google Sheets, FILTER accepts multiple conditions separated by commas and has no argument for a custom message when there are no matches. Since it returns #N/A in that case, wrap it in IFERROR to display a custom message.

 

Can you look up values using multiple criteria?

Yes. Use & to join the criteria in XLOOKUP. For example, =XLOOKUP(G3&H3, B2:B100&C2:C100, E2:E100) returns the employee's salary when you enter their name in G3 and their department in H3. In older versions of Excel, create a helper column that combines the text first.

 

Can you look up a partial text match?

Yes. Use * to match any number of characters, as in =VLOOKUP("*สมชาย*", B2:E100, 4, FALSE). With XLOOKUP, use 2 as the fifth argument, as in =XLOOKUP("*สมชาย*", B2:B100, E2:E100, "ไม่พบ", 2).

 

 Related Articles

HumanSoft team ready to helpHumanSoft Payroll & HR SolutionFree 30-day trial, all HR functions
  • Free setup service.
  • No expenses at all.
  • Dismiss at any time.
Try it free