View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default vlookup with trim function

=index('[data.xls]sheet1'!$d$2:$d$446,
match(e10,trim('[data.xls]sheet1'!$b$2:$b446,0))

is the guts of your lookup.

This is an array formula. Hit ctrl-shift-enter instead of enter. If you do it
correctly, excel will wrap curly brackets {} around your formula. (don't type
them yourself.)

Adjust the range to match--but you can't use the whole column.


rodgie wrote:

I am using a vlookup but the data it is searching is protected. I am
getting a few N/A's returned as there are some blanks after the data
fields. As I cannot insert a column in the searched data (as its
protected) can I use a nested trim somehow? or can it only be done by
copying the data somewhere?

This is my funtion so far (might look a bit messy but works)

=IF(ISBLANK(E10),0,IF(COUNTIF('[data]Sheet1'!$B$2:$D$446,E10),VLOOKUP(TRIM(E10),'[data.xls]Sheet1'!$B$2:$D$446,3,FALSE),"check"))

I think i need the trim before the table array
[data.xls]Sheet1'!$B$2:$D$446 but I cannot figure it out.

Any help would be appreciated.

--
rodgie
------------------------------------------------------------------------
rodgie's Profile: http://www.excelforum.com/member.php...o&userid=35090
View this thread: http://www.excelforum.com/showthread...hreadid=548513


--

Dave Peterson