Excel is reading data differently with spaces vs without spaces

Copper Contributor

I have sheet 1 that is reading data from sheet 2  (the data includes spaces), but for some reason when I delete the spaces on Sheet 1 it pulls different data from sheet 2. Here is the formula I'm using: =IF($A3>" ",VLOOKUP($A3,Sheet1!$A$2:$T$18748,9)," ")

 

I thought I needed to use the TRIM function but that didn't work. 

 

Please help! Annotation 2020-01-31 110836.png

4 Replies

@Kristen_C -

 

Try SUBSTITUTE instead of TRIM:

 

1.png

 

@ChrisMendoza How do I do that with my vlookup formula? 

@Kristen_C -

 

I was thinking below, but have not tested. I was really just showing a method to remove " " (spaces) in a string.

VLOOKUP(SUBSTITUTE($A3, " ", ""),Sheet1!$A2:$T$18748,9)

 

Try adding ,0 at the end of your lookup. This is the same as FALSE and tells Excel you’re looking for an exact match for A2:
=IF($A3>" ",VLOOKUP($A3,Sheet1!$A$2:$T$18748,9,0)," ")