CellSkill
CH
Cypress HR Services
Payroll runs in 30 min

Make the broken VLOOKUP work despite trailing spaces

The legacy HRIS export carried trailing spaces on several timesheet names — your exact-match VLOOKUP returns #N/A on those rows. The master is clean. Wrap the lookup value with TRIM and drag the formula down so every employee's salary resolves in one pass.

TRIMIntermediate . 4 min . HR & Operations
Lesson 6 · TRIM

Fix payroll VLOOKUP failing on a trailing space

Intermediate~4 min
Learning objective

Practice using TRIM to solve a real hr & operations problem. By the end, you’ll know when to reach for it and how to structure the arguments correctly.

Scenario

Payroll runs in 30 minutes. The timesheet export came in from the legacy HRIS and several names have trailing spaces baked in — your VLOOKUP against the clean master payroll table is returning #N/A on those rows. Wrap the lookup value with TRIM and drag the formula down so every row resolves cleanly.

Goal

In E2, return the timesheet salary by VLOOKUPing the TRIMmed D2 against the master (A2:B9). Anchor the master range with $ signs and drag down through E9 — TRIM is a no-op on already-clean names, so the same formula handles both.

How TRIM works

TRIM removes leading and trailing spaces from text and collapses any run of internal spaces down to a single space. The one-function pre-flight check before any lookup, comparison, or join - because imported data from CRMs, PDFs, and web scrapes is almost never as clean as it looks.

Syntax
TRIM(text)
Read the full TRIM guide
Stuck? Reveal the hint

Try the formula first. Hints cost CP for a reason.

Fix payroll VLOOKUP failing on a trailing space | TRIM Exercise | CellSkill