Look up salary by employee ID (XLOOKUP)
You are putting together a department salary report. Employee IDs and departments are already filled in, but the Matched salary column is still empty. Write a formula in G2:G6 so each row looks up the salary for the employee ID in column E from the staff roster in columns A–C.
Your solution should use cell references so it updates automatically when Test Case input values change.
Notes
XLOOKUP does not require a column index. Keep lookup and return arrays the same height. Default match mode is exact. Lock the table ranges with $ if you fill the formula down.
Function guide
FAQ
How do I look up a salary with XLOOKUP?
Use =XLOOKUP(E2, A2:A6, C2:C6) when E2 holds the ID, A2:A6 the ID list, and C2:C6 the salaries. Fill down for the other Lookup ID rows.
Does XLOOKUP need a column index like VLOOKUP?
No. You pass the return array directly, so column moves will not break a column-index argument.
Why lock ranges with $ when filling down?
Without $, A2:A6 and C2:C6 shift as you copy the formula down. Absolute refs $A$2:$A$6 and $C$2:$C$6 keep the employee table fixed while E2 becomes E3, E4, and so on.