View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Spaces at the end of data

data in which there is a space at the end.
If you are sure there is only one space you can try out the below..

With data in Col A/B and lookup value in C1

=IF(ISNA(VLOOKUP(C1,A:B,2,0)),IF(ISNA(VLOOKUP(C1&"
",A:B,2,0)),"",VLOOKUP(C1&" ",A:B,2,0)),VLOOKUP(C1,A:B,2,0))

Depending on your data you can try the below formula using MATCH() and
INDEX(). Please note that the below will lookout for the first entry in the
list which match the lookup value string..
=INDEX(B:B,MATCH(C1&"*",A:A,0))


If this post helps click Yes
---------------
Jacob Skaria


"sjs" wrote:

I'm trying to run a vlookup but the search array has some cells that contain
data in which there is a space at the end. Is there an easy way to remove
the end space when only some of the cells have the space?

tks,
steve