Why TRIM() and trimWhitespace() both fail on pasted data
The built-in TRIM() formula and the menu option Data > Data cleanup > Trim whitespace both work on ASCII space (character code 32). They do nothing with U+00A0, the non-breaking space that browsers inject whenever you copy from a webpage, a Google Doc, or a PDF viewer. It looks identical to a regular space on screen, but it is a different character — so TRIM() returns the string unchanged, and VLOOKUP quietly misses every row.
You can confirm this is your problem without writing any code: in an empty cell, type =CODE(LEFT(A1,1)) where A1 holds the suspicious value. A result of 160 means non-breaking space. A result of 32 means normal space. The script below handles both.