ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Approximate matches with vlookup? (https://www.excelbanter.com/excel-worksheet-functions/137299-approximate-matches-vlookup.html)

Keith R

Approximate matches with vlookup?
 
I have two worksheets, and I need to vlookup the values from the cells on
one worksheet against the other. The problem is that one or both of the
source and comparison values may have trailing spaces, so I thought trim
would be appropriate- something like:

=VLOOKUP(TRIM(C7),TRIM('revised date'!trimB5:G878),6,FALSE)

but that isn't working either. I suspect that most of the time I have one or
more char(32) on the end of the comparison value array cells, so I'm open to
any suggestions on how to ensure the match. Each number may have a different
number of digits or characters, so I can't just use left(8), for example.

Thanks for any ideas,
Keith




[email protected]

Approximate matches with vlookup?
 
If there is a part of a field you can search for in the other sheet,
you can use the SEARCH function which lets you find a portion of a
string with in another and use wild characters...



T. Valko

Approximate matches with vlookup?
 
The problem is that one or both of the source and comparison values may
have trailing spaces


Try this:

=VLOOKUP(TRIM(C7)&"*",'revised date'!B5:G878,6,0)

Biff

"Keith R" wrote in message
...
I have two worksheets, and I need to vlookup the values from the cells on
one worksheet against the other. The problem is that one or both of the
source and comparison values may have trailing spaces, so I thought trim
would be appropriate- something like:

=VLOOKUP(TRIM(C7),TRIM('revised date'!trimB5:G878),6,FALSE)

but that isn't working either. I suspect that most of the time I have one
or more char(32) on the end of the comparison value array cells, so I'm
open to any suggestions on how to ensure the match. Each number may have a
different number of digits or characters, so I can't just use left(8), for
example.

Thanks for any ideas,
Keith







All times are GMT +1. The time now is 01:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com