
What You’ll Learn
VLOOKUP and HLOOKUP in Excel are the two formulas that turn a frustrating, manual spreadsheet grind into something that practically runs itself. Picture this: your manager drops a 600-row product list on your desk and asks you to match every item to its price from a separate catalog sheet. Before you know these formulas, that job takes an hour. After you know them, it takes about thirty seconds. That is not an exaggeration.
This guide will walk you through both functions from scratch — syntax, step-by-step examples, error fixes, and all. Whether you are pulling employee salaries from a database, matching product codes to prices, or grading student scores automatically, these two formulas do the heavy lifting for you.
By the end of this lesson you will know exactly how to write both formulas, when to use each one, and how to fix the errors that trip up almost every beginner.
Here is the thing most spreadsheet beginners do not realise early enough. A huge amount of Excel work comes down to one question: given this value, what related information can you find? What is the price of this product? What is the salary of this employee? What grade does this score earn?
Lookup functions answer exactly that kind of question. You give Excel a value to search for, tell it where to look, and it brings back whatever you need from the same row or column. No scrolling, no copy-pasting, no human error.
Before lookup formulas, people handled this stuff manually. They would search with Ctrl+F, copy a value, paste it somewhere else, move on to the next row, repeat five hundred times. That is not just slow — it is a recipe for mistakes that are genuinely hard to spot later.
VLOOKUP and HLOOKUP make the connection between two tables dynamic. Change something in your source data and the formula updates automatically. That alone saves people hours every week.
The difference between the two is simply the direction your data flows.
| Function | Stands For | Searches | Best Used When |
|---|---|---|---|
| VLOOKUP | Vertical Lookup | Down the first column | Data in rows, headers across the top |
| HLOOKUP | Horizontal Lookup | Across the first row | Data in columns, labels down the left |
The Excel VLOOKUP formula follows this structure:
=VLOOKUP(lookup_value, table_array, col_index_num, range_lookup)
Here is what each argument means:
Say your product catalog lives on Sheet2 — column A has product codes, column B has prices. On Sheet1, you want to type a product code into cell A2 and have the matching price appear in B2 automatically.
Step-by-Step
=VLOOKUP( to start the formula.Your finished formula should look like this:
=VLOOKUP(A2, Sheet2!A:B, 2, FALSE)
Trust me on this — use FALSE almost every time. The VLOOKUP exact match setting means Excel will only return a result when it finds a value that matches perfectly. If there is no match, you get an error, which sounds annoying but is actually useful. An error tells you something is wrong. A wrong answer looks fine on the surface and causes real problems later.
Use exact match whenever you are searching by IDs, codes, names, or any value that needs to be precisely right.
Approximate match has a specific, limited use case. It is designed for tiered lookups where you want to find the highest threshold that does not exceed your search value. Commission tables are the classic example — if sales between 0 and 9,999 earn 5%, and sales between 10,000 and 19,999 earn 10%, you can set up a table with those thresholds and use TRUE to return the right rate.
One condition: your table must be sorted in ascending order or the results will be completely unreliable.
Advertisement-X
The HLOOKUP formula is the mirror image of VLOOKUP. Same logic, different axis:
=HLOOKUP(lookup_value, table_array, row_index_num, range_lookup)
You have a grading rubric where row 1 contains score thresholds (0, 41, 61, 81) and row 2 contains grade letters (F, C, B, A). A student’s score sits in cell B2 and you want the grade to appear in C2.
Step-by-Step
=HLOOKUP(Your formula will look something like this:
=HLOOKUP(B2, $E$1:$H$2, 2, TRUE)
You’ve probably seen teachers spend ages manually assigning grades from a marking sheet. With HLOOKUP, a teacher sets up the rubric once at the top of the spreadsheet, writes the formula once, and copies it down for all 30 students. Change the rubric thresholds and all 30 grades update instantly. It is the kind of thing that makes people look like spreadsheet wizards without doing anything particularly complicated.
Think of VLOOKUP and HLOOKUP as the same knife used for two different cuts. The logic is identical — you are matching a value and returning related information. The only question is whether your data runs top to bottom or left to right.
In day-to-day work, VLOOKUP wins by a wide margin. Most databases, exported reports, and tables are set up vertically. HLOOKUP comes into its own for horizontal summary tables, rubrics, and dashboards where categories run left to right. If you are building a new spreadsheet from scratch and you have a choice, go vertical — VLOOKUP is more widely supported and easier to troubleshoot.
This is where VLOOKUP starts doing serious work. Rather than keeping all your data in one sheet — which gets messy fast — you can have a clean lookup table on one sheet and your working data on another. The formula is almost identical. You just include the sheet name followed by an exclamation mark before the range:
=VLOOKUP(A2, Sheet2!A:C, 3, FALSE)
This searches column A on Sheet2, finds the match, and returns the value from column C of that same row.
Here is something that catches a lot of people out. When you copy a VLOOKUP formula down a column of cells, Excel shifts the table_array reference by default. That means by the time you get to row 10, your formula is searching a completely wrong part of the spreadsheet.
The fix is absolute references. Add dollar signs to lock your range in place:
=VLOOKUP(A2, $B$2:$D$100, 2, FALSE)
No matter how far you copy the formula, the table_array stays exactly where you put it.
💡 PRO TIP
You do not have to type the dollar signs manually. Click inside the table_array part of your formula, then press F4. Excel adds the dollar signs for you instantly. Press F4 again to cycle through different reference types. This single shortcut saves more time than you might expect.
Errors are not failures — they are messages. Each one tells you something different, and once you know the language, fixing them becomes straightforward.
The #N/A error means Excel searched through your table and could not find a match. Common causes include:
=TRIM(A2)Start by checking for hidden spaces. That is the culprit more often than you would think.
A #VALUE! error usually points to a problem with the col_index_num argument — either it is less than 1, or you have accidentally passed an array where Excel expected a single value. Double-check that argument first.
A #REF! error means your col_index_num is higher than the number of columns in your table_array. If your table is three columns wide and you asked for column 5, Excel has nowhere to go. Count your columns carefully and adjust the index number.
Nobody wants their carefully built spreadsheet showing a wall of red errors to other users. Wrap your VLOOKUP in IFERROR to display a clean, friendly message instead:
=IFERROR(VLOOKUP(A2, Sheet2!A:C, 2, FALSE), “Not found”)
Now instead of an ugly error, the cell shows “Not found” — or whatever message makes sense in context. This is especially valuable in shared workbooks where colleagues will be entering data that might not always exist in the lookup table.
For more on combining formulas with logical functions like this, check out the IF Function in Excel lesson on XplorExcel.com.
⚠️ COMMON MISTAKE
The most common VLOOKUP mistake — by far — is copying a formula down a column without first locking the table_array. The formula works perfectly in the first row, then creeps downward with every copy, searching completely different ranges. Always press F4 to lock your table_array before copying. Always.
Here is the thing about VLOOKUP that surprises most people the first time they hit it. The function can only return values from columns to the right of the lookup column. If your lookup column is column D but the data you need is in column B, VLOOKUP simply cannot do it. That is a hard limitation baked into the function.
There is another issue that is less obvious but arguably more dangerous. If someone inserts or deletes a column inside your table_array, your col_index_num becomes wrong. And because Excel does not throw an error — it just returns a different column’s data — you might not notice for days or weeks. It is a silent failure, and it has caused real problems in real workplaces.
INDEX-MATCH solves both of those problems. It can look in any direction, and it references columns by name rather than position, so insertions do not break it. XLOOKUP, available in Excel 365 and Excel 2021, goes even further — simpler syntax, no column counting, and the ability to return entire arrays.
That said, VLOOKUP and HLOOKUP in Excel remain standard in huge numbers of workplaces, especially those running older Excel versions. Learning them is not a waste of time — it is the foundation that makes everything else easier to pick up.
The INDEX and MATCH lesson on XplorExcel.com is the natural next step once you are comfortable here.
🧪 TRY IT YOURSELF — Exercise 1: Employee Salary Lookup (VLOOKUP)
Build a simple two-sheet workbook. On Sheet2, create a table: Employee ID in column A, Employee Name in column B, Salary in column C. Enter five rows of data.
On Sheet1, type one of the Employee IDs into cell A2. In B2, write a VLOOKUP that pulls the matching salary from Sheet2. Use FALSE for exact match. Lock your table_array with F4 before copying the formula down to row 6 and testing with different IDs.
If you get a #N/A error, double-check that the ID in A2 exactly matches one of the IDs in Sheet2, including number format.
🧪 TRY IT YOURSELF — Exercise 2: Student Grade Report (HLOOKUP)
Set up a rubric table on your sheet. Row 1: enter 0, 41, 61, 81. Row 2: enter F, C, B, A.
In a separate column, enter ten sample student scores. In the column next to it, write an HLOOKUP that returns the correct grade for each score. Use TRUE for approximate match.
If your grades are coming back wrong, check that the rubric row is sorted in ascending order — that is a requirement for approximate match to work correctly.
VLOOKUP searches the first column of a table and returns data from a column to the right. HLOOKUP searches the first row and returns data from a row below. Both use the same logic — the difference is purely the direction your data runs.
Nine times out of ten it is one of two things. Either you used TRUE instead of FALSE in the range_lookup argument, so Excel returned an approximate match when you wanted an exact one. Or you copied the formula without locking the table_array, so the range shifted. Check both of those before digging deeper.
No, it cannot. VLOOKUP is hard-wired to return values from columns to the right of the lookup column. If you need to look left, use INDEX-MATCH — that combination has no directional restriction.
VLOOKUP and HLOOKUP in Excel are still active in millions of real workbooks right now. If your workplace uses Excel 2016 or 2019, you are going to need VLOOKUP. Even if you are on Excel 365 where XLOOKUP is available, understanding VLOOKUP first makes the newer function easier to learn. Start here, then expand.
📚 Further Reading
The official Microsoft documentation for VLOOKUP — covers all arguments with syntax examples.
Excellent worked examples for when you need to look up values matching more than one condition.
← Previous Lesson
IF & Logical Functions in ExcelNext Lesson →
INDEX & MATCH in ExcelAdvertisement-X