Practice problems / Lookup & Reference

Pull multiple columns for an employee (VLOOKUP)

Medium Lookup & Reference
Description
Hints 0/5
Solutions 2
–
Test case
1
2
3
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

The problem

Problem statement

You are building an employee profile card. Given an employee ID in F2, pull their Department into G2 and City into H2 from the master employee directory in columns A–D. Lock the table reference with $ so the lookup formula remains stable across columns.

Lock the table with $ and change only the column index — the same formula has to serve the city column too.

Problem data

Show the sheet as a table (selectable, copyable)
The exercise data, as a table
ABCDFGH
1 Emp IDNameDepartmentCityEmp IDDepartmentCity
2 E-101Alice ChenFinanceNew YorkE-103
3 E-102Bob TaylorEngineeringSeattle
4 E-103Carla MendezMarketingChicago
5 E-104David KimSalesAustin
6 E-105Eva RossiOperationsDenver

Notes

When fetching multiple fields for the same ID, keep the table range locked ($A$2:$D$6) and the lookup value column-locked ($F$2 or $F2). Then increment col_index_num: column 3 for Department, column 4 for City.

How to approach

Your answer goes in G2:H2. On submit we re-run your formula against 3 different sets of input, so a hardcoded number will fail — the formula has to follow the cells.

  1. Target cells are G2:H2 — write the formula in G2 for Department first
  2. In G2, lookup_value is $F$2, table_array is $A$2:$D$6
  3. Department is the 3rd column in the master table (col_index_num = 3)
  4. City is the 4th column in the master table (col_index_num = 4)
  5. Use FALSE (or 0) for range_lookup to ensure exact ID matching

Official solutions

Show 2 solutions — try it yourself first

Approach 1: Standard VLOOKUP with absolute references

=VLOOKUP($F$2, $A$2:$D$6, 3, FALSE)

Looks up the Emp ID in $F$2 within the locked table $A$2:$D$6. Index 3 extracts Department in G2 (and index 4 extracts City in H2).

Approach 2: Relative row with locked lookup column

=VLOOKUP($F2, $A$2:$D$6, 3, FALSE)

Locking column F ($F2) allows you to copy or drag the formula horizontally to column H while keeping the lookup pointer fixed on Emp ID.

Function guide

Related practice

FAQ

How do I use VLOOKUP to return multiple columns?

Keep the lookup value ($F2) and table array ($A$2:$D$6) locked with $. In each output column, set col_index_num to the appropriate column number (3 for Department, 4 for City).

Can VLOOKUP return multiple columns automatically?

In modern Excel (Microsoft 365) and Google Sheets, you can pass an array constant like {3, 4}: =VLOOKUP(F2, A2:D6, {3, 4}, FALSE), which spills both columns at once.

What if an Employee ID is not found?

VLOOKUP returns #N/A. To handle missing entries cleanly, wrap the VLOOKUP in IFERROR or IFNA: =IFERROR(VLOOKUP($F$2, $A$2:$D$6, 3, FALSE), "Not Found").