Fix Excel VLOOKUP Errors with Employee and Course Criteria
Question details
Find out why a VLOOKUP using an employee name and course title returns errors for some training courses.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- An employee training lookup combines a name and course title to find a matching record in an export table.
- Observed behavior
- The lookup works for most courses but returns an error for certain courses.
Compare the lookup value with the key in the export table and identify the employee, course, and result columns. Check whether the export key contains both the employee name and course title or only the employee name.
Create a Matching Employee and Course Key
Use this method when the result must match both an employee and a specific course.
VLOOKUP searches the first column of its lookup range. Build the same combined key in both the reference table and the lookup formula.
In the export table, place a helper column in A, employee names in B, course titles in C, and the value to return in D. Adjust these column references if your table is arranged differently.
In cell A2, enter =TRIM(B2)&"|"&TRIM(C2), then fill the formula down the helper column. This joins the name and course with a separator and removes ordinary extra spaces.
If the employee name to find is in F2 and the course title is in G2, enter =VLOOKUP(TRIM(F2)&"|"&TRIM(G2),$A$2:$D$100,4,FALSE) in the result cell. Adjust the range to include all reference rows.
If a cell still shows #N/A, compare the employee name and course title in F2 and G2 with the corresponding entries in columns B and C. Correct spelling, text differences, or unusual spaces in the source data.

Match Only the Employee Name When the Export Key Contains Names
Use this method when the export table is keyed only by employee name and the desired result does not depend on the course.
Use WPS Spreadsheets to Match Employees and Courses
Open your training workbook in WPS Spreadsheets and use a helper column with VLOOKUP to match each employee and course.
- 1. Open the workbook: In WPS Spreadsheets, select Open and choose your Excel training workbook.
- 2. Create a helper key: With employee names in column B and courses in column C, enter =TRIM(B2)&"|"&TRIM(C2) in A2 and fill it down.
- 3. Enter the lookup: With lookup criteria in F2 and G2 and results in column D, enter =VLOOKUP(TRIM(F2)&"|"&TRIM(G2),$A$2:$D$100,4,FALSE) in the result cell. Adjust the range to fit your table.
- 4. Save the workbook: Select File > Save As and choose an Excel format such as XLSX.

Frequently Asked Questions
Why does VLOOKUP return #N/A for only some courses?
The combined lookup value may differ from the export table key because of spelling, spacing, or a missing course title. Compare the affected employee and course values with the first column of the lookup range.
Can VLOOKUP match both an employee and a course?
Yes. Create a helper column that joins the employee name and course title, then use the same combination as the lookup value. Put the helper column first in the VLOOKUP range and use FALSE for an exact match.
What happens if two rows have the same employee and course key?
VLOOKUP returns the value from the first matching row in the selected range. Check the reference table for duplicates and decide which record you need.
Will TRIM remove every kind of extra space?
No. TRIM removes ordinary extra spaces, but some imported data may contain nonbreaking spaces or other characters. Inspect and clean those characters in the source cells if the values still do not match.




