FxFormula Drills

VLOOKUP practice test

A useful VLOOKUP practice test asks three things: an exact match with FALSE, a lookup that runs across instead of down, and an approximate match on a sorted numeric bracket. Work the sheets below before you read the formulas. Then redo the same ideas in the drills, where a hardcoded number does not pass.

Syntax

VLOOKUP

VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

Vertical lookup. The key is in the first column of table_array. col_index_num is 1 for that column, 2 for the next column to the right. FALSE means exact. TRUE means approximate and requires the first column sorted ascending.

HLOOKUP

HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup])

Horizontal lookup. The key is in the first row of table_array. row_index_num is 1 for that header row and 2 for the row directly under it. FALSE means exact, the same rule as VLOOKUP.

XLOOKUP

XLOOKUP(lookup_value, lookup_array, return_array, [if_not_found], [match_mode], [search_mode])

One function for both directions. match_mode -1 is the approximate form that corresponds to VLOOKUP's TRUE: exact match, or the next smaller item.

Comparison

QuestionVLOOKUPHLOOKUPXLOOKUP
DirectionDown a columnAcross a rowEither, depending on the ranges
Where the key livesFirst column of the tableFirst row of the tableWhatever range you pass as lookup_array
How you name the resultColumn index from the left of the tableRow index from the top of the tableA separate return range
Exact matchFALSEFALSEDefault, match_mode 0
Approximate, next smallerTRUE, first column sorted ascendingTRUE, first row sorted ascendingmatch_mode -1, lookup array sorted ascending
Looking the other way on the same table#N/A or the wrong field if the table is sideways#N/A or the wrong field if the table is verticalSwap the ranges

Worked examples

Question 1. February's sales, labels across the top

Months run across row 1 and the sales sit in row 2. E2 says Feb. Decide which function searches a header row, then check your result against 20.

Jan 10, Feb 20, Mar 30.
RowABCDE
1JanFebMarFind
2102030Feb
  • =HLOOKUP(E2,A1:C2,2,FALSE) → 20
  • =VLOOKUP(E2,A1:C2,2,FALSE) → #N/A
  • =XLOOKUP(E2,A1:C1,A2:C2) → 20

HLOOKUP finds Feb in the first row and returns row 2 of the table, the cell underneath, which is 20. VLOOKUP looks down the first column. That column is Jan and 10, so Feb is not there and the exact match is #N/A. XLOOKUP searches the month row and returns the sales row, so it does the horizontal job without a separate function.

Question 2. Exact product price

E2 is Book. Return the price. The match has to be exact, because a nearby product is the wrong answer.

Pen 1.5, Book 12, Lamp 24.
RowABCDE
1ProductPriceQtyFind
2Pen1.54Book
3Book122
4Lamp241
  • =VLOOKUP(E2,A2:C4,2,FALSE) → 12
  • =XLOOKUP(E2,A2:A4,B2:B4) → 12

Column index 2 is the price, the second column of A2:C4. FALSE refuses to settle for a different product. The quantity is column 3 if a later question asks for it. XLOOKUP names B2:B4 instead of counting.

Question 3. Commission bracket

Rates apply from a minimum upward. 0 to 99 pays 0.02, 100 to 499 pays 0.05, and 500 or more pays 0.08. The first column is sorted ascending. 100, 499, and 500 are the three checks.

Sorted minimums in column A and rates in column B.
RowABCD
1MinRate
200.02100
31000.05499
45000.08500
  • =VLOOKUP(D2,A2:B4,2,TRUE) → 0.05
  • =VLOOKUP(D3,A2:B4,2,TRUE) → 0.05
  • =VLOOKUP(D4,A2:B4,2,TRUE) → 0.08
  • =XLOOKUP(D3,A2:A4,B2:B4,,-1) → 0.05

100 lands on the 100 bracket, so the rate is 0.05. 499 is not a key in the list. Approximate match returns the largest minimum that is still less than or equal to 499, which is 100, so the rate stays 0.05. 500 starts the next bracket, 0.08. XLOOKUP with match_mode -1 does the same step for 499. Do not use TRUE on an unsorted list of names.

When to use which

Practice the exact match until FALSE is automatic

Most job-screen lookups are exact: a sku, an employee id, a GL account. Type the fourth argument. Say the column index out loud while you count from the search column.

Practice HLOOKUP on a real header row

Monthly columns are the layout that still wants HLOOKUP in older files. Remember that row index 2 is the first value row, not the header. If the labels are down a column, you wanted VLOOKUP.

Practice one approximate table, then stop using TRUE elsewhere

Build the commission table once so you can see 499 fall back to the 100 rate. After that, treat TRUE as a special case you opt into, not as the thing VLOOKUP does when you are in a hurry.

Common mistakes

Using VLOOKUP on a horizontal month row

The sample above returns #N/A because Feb is not in the first column. Direction is part of the function name. If the key runs across, use HLOOKUP or XLOOKUP.

An approximate match on text that is not sorted

TRUE does not mean 'close enough spelling'. It means 'largest value that is less than or equal to the lookup, assuming ascending order'. Product names in the order people typed them do not qualify.

Off-by-one column index

People count the worksheet column letters. Count inside the table instead. If you included a label column you do not search, the index shifts.

Typing the answer instead of the formula

On Formula Drills a bare 12 does not pass a lookup drill, even though 12 is the price. The checker wants a formula that calls the function and recalculates when the key changes.

Versions and compatibility

VLOOKUP and HLOOKUP work in Excel 2021, Microsoft 365, older Excel, and Google Sheets. The TRUE and FALSE arguments mean the same thing in Google Sheets.

XLOOKUP, including match_mode -1 for the commission bracket, needs Excel 2021, Excel 2024, Microsoft 365, Excel for the web, or Google Sheets. It is not in Excel 2019.

These sheets use comma separators. In a locale that expects semicolons, the formulas need semicolons and the structure stays the same.

Practice on Formula Drills

Free drills are open with no account. Premium drills show the problem to everyone and grade the sheet for subscribers.

Free exercises

Premium exercises

Function pages

FAQ

How long should a VLOOKUP practice test take?

There is no official timing. The three questions on this page are enough to see whether exact match, horizontal lookup, and sorted brackets are separate ideas for you. The drills add a blank cell and instant grading.

Should I memorize column numbers?

Memorize the counting rule, not a library of indexes. The search column is 1. Each column to its right adds one. If the table changes shape, count again.

What is a passing result?

The formula returns the figure in the explanation and still returns it after you change the lookup cell. A pasted value that happens to equal the answer is not the skill.

Where do I practice this on a sheet that grades me?

The free reference drill is the warm-up. The premium VLOOKUP, HLOOKUP, and commission-tier drills are the graded versions of questions 2, 1, and 3.