How to use HLOOKUP in Excel: look up values in a horizontal table
HLOOKUP finds values in a table whose headers run across a row: months, tariffs, tiers. Syntax, row number, TRUE vs FALSE and common traps — with examples.
HLOOKUP is VLOOKUP’s twin for horizontal tables. It searches for a value in the first row of a table and returns a result from a lower row in the matching column. The name stands for “horizontal lookup” — searching from left to right.
When you need it: a plan-vs-actual report with months across the columns, a delivery tariff with weight tiers along a row, figures by year. In other words, any table whose headers sit at the top, along a row.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Month | Jan | Feb | Mar2 | Apr | May | |
| 2 | Plan | 120 | 130 | 150 | 140 | 160 | |
| 3 | Actual | 118 | 135 | 1493 | 150 | 171 | |
| 4 | |||||||
| 5 | Month: | Mar1 | |||||
| 6 | Actual: | 149 | |||||
| 7 |
Syntax
=ГПР(lookup_value; table_array; row_index_num; [range_lookup])
lookup_value— what to find: a month, year or code.table_array— the table. The search happens only in its first row.row_index_num— which row of the table to return. The header row is 1, the next one is 2, and so on.range_lookup—FALSE(0) for an exact match;TRUEor omitted for an approximate match (the first row must increase from left to right).
The only difference from VLOOKUP: VLOOKUP asks for a column number, HLOOKUP asks for a row number.
Writing HLOOKUP step by step
1
Select the result cell (B6). Формулы → Ссылки и массивы → HLOOKUP.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Month | Jan | Feb | Mar | Apr | May | |
| 2 | Plan | 120 | 130 | 150 | 140 | 160 | |
| 3 | Actual | 118 | 135 | 149 | 150 | 171 | |
| 4 | |||||||
| 5 | Month: | Mar | |||||
| 6 | Actual: | ||||||
| 7 |
2
Enter the arguments: Lookup_value — B5; Table_array — select A1:F3 and press F4; Row_index_num — 3 (Actual is row 3 of the table); Range_lookup — FALSE.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Month | Jan | Feb | Mar | Apr | May | |
| 2 | Plan | 120 | 130 | 150 | 140 | 160 | |
| 3 | Actual | 118 | 135 | 149 | 150 | 171 | |
| 4 | |||||||
| 5 | Month: | Mar | |||||
| 6 | Actual: | ||||||
| 7 |
3
Click OK. Now change the month in B5 — type “May”, for example. The formula instantly shows May’s actual: one cell lets you “query” any month.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Month | Jan | Feb | Mar | Apr | May | |
| 2 | Plan | 120 | 130 | 150 | 140 | 160 | |
| 3 | Actual | 118 | 135 | 149 | 150 | 1712 | |
| 4 | |||||||
| 5 | Month: | May1 | |||||
| 6 | Actual: | 171 | |||||
| 7 |
Approximate match: a delivery tariff
A courier service charges by weight tier: up to 1 kg — 15,000, 1–5 kg — 25,000, and so on. Put the starting weight of each tier in the first row in ascending order and use TRUE.
HLOOKUP takes the closest tier that is not greater than the weight you look up: for 7 kg, that is the 5 kg column.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Weight, kg | 0 | 1 | 52 | 10 | 20 | |
| 2 | Price, soum | 15 000 | 25 000 | 40 000 | 60 000 | 90 000 | |
| 3 | |||||||
| 4 | Client | Weight, kg | Delivery | ||||
| 5 | Aziz | 0,8 | 15 000 | ||||
| 6 | Dilnoza | 71 | 40 000 | ||||
| 7 | Javohir | 12,5 | 60 000 | ||||
| 8 |
Pro level: pick the row number with MATCH
When a report has several measures (plan, actual, number of clients), don’t type the row number by hand — let MATCH find it in the first column:
=ГПР(B6;$A$1:$E$4;ПОИСКПОЗ(B7;$A$1:$A$4;0);ЛОЖЬ)
Now you choose a month and a measure in two cells and get any intersection of the table. That is a two-way lookup.
Two more tips:
- In Excel 2021/365,
=ПРОСМОТРX(B6;B1:E1;B3:E3)does the same job: no row number needed, and the result row may even be above. - If the data is yours and still horizontal, it is often better to store it vertically (Paste Special → Transpose): vertical tables are easier to filter, sort and summarize with a PivotTable.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Measure | Jan | Feb | Mar | Apr | |
| 2 | Plan | 120 | 130 | 150 | 140 | |
| 3 | Actual | 118 | 135 | 149 | 150 | |
| 4 | Clients | 410 | 455 | 470 | 502 | |
| 5 | ||||||
| 6 | Month: | Apr | ||||
| 7 | Measure: | Clients | ||||
| 8 | Result: | 502 | ||||
| 9 |
Try it in the simulator
The delivery tariff is at the top. Type =ГПР(B5;$B$1:$F$2;2;ИСТИНА) in C5 and fill it down to C7. Then change the weight in B6 to 10 and watch which tier the price moves to.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Weight, kg | 0 | 1 | 5 | 10 | 20 | ||||||||||||||||||
| 2 | Price, soum | 15000 | 25000 | 40000 | 60000 | 90000 | ||||||||||||||||||
| 3 | ||||||||||||||||||||||||
| 4 | Client | Weight, kg | Delivery | |||||||||||||||||||||
| 5 | Aziz | 2,5 | ||||||||||||||||||||||
| 6 | Dilnoza | 0,5 | ||||||||||||||||||||||
| 7 | Javohir | 18 | ||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 | ||||||||||||||||||||||||
| 11 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.