Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
bill gras
 
Posts: n/a
Default problem lookup function

I have 250 names of towns in work sheet " DU " starting at cell D26 down to
D250.
those names are like this : Dubbo (g7)
Darwin (a2)
Sydney (k5) and so on .
In work sheet " Towns " column " B " I have the same names without the last
4 caracters, (g7) , (a2) , (k5) like this Dubbo
Darwin
Sydney
In column " C " opposite the towns names I have a distance number 505

220

710
In column cell " A45 " I have the formula
=LEFT(DU!D26,LEN(DU!D26)-RIGHT(4))
which gives me the name of the town wihout the last 4 caracters Dubbo

Darwin

Sydney
In column ' L " I have a lookup function: =VLOOKUP(A45,B2:C250,2,FALSE)
which should give me :- 505 , but it returns #N/A

Can any one help me please

thank you for your time
regards B Gras

  #2   Report Post  
AdamD
 
Posts: n/a
Default


Your problem is in the formula in cell A45. You are capturing the space
" " after the town name and before the "(g7)". The easy fix is to
change the formula in A45 to remove the last 5 characters instead of
four =LEFT(DU!D26,LEN(DU!D26)-RIGHT(*5*)).

The issue you will then face is if the coordinate or whatever the
"(g7)" represents ever changes in length. If it is possible that you
could have a (g12) or an (AA5) then you will again be faced with having
the space as part of the town name. A way to avoid this is to find the
space in the text string and only take the town name before the space.
=LEFT(DU!D26,LEN(DU!D26)-(LEN(DU!D26)-(FIND(" ",DU!D26,1)-1)))

Then your problem will be if you have a town name with a space as part
of the town name such as New York. Your safest bet is to locate the
open parenthesis "(" and to remove text that is to the the right of one
position left of the open parenthesis
=LEFT(DU!D26,LEN(DU!D26)-(LEN(DU!D26)-(FIND("(",DU!D26,1)-2)))


Hope this helps,
Adam


--
AdamD
------------------------------------------------------------------------
AdamD's Profile: http://www.excelforum.com/member.php...o&userid=24530
View this thread: http://www.excelforum.com/showthread...hreadid=381229

  #3   Report Post  
RagDyeR
 
Posts: n/a
Default

Change your text extraction formula!
You're not removing the *space* after the name.

Try either of these:

=LEFT(DU!D26,LEN(DU!D26)-5)

=LEFT(DU!D26,FIND(" ",DU!D26)-1)
--

HTH,

RD
==============================================
Please keep all correspondence within the Group, so all may benefit!
==============================================


"bill gras" wrote in message
...
I have 250 names of towns in work sheet " DU " starting at cell D26 down to
D250.
those names are like this : Dubbo (g7)
Darwin (a2)
Sydney (k5) and so on .
In work sheet " Towns " column " B " I have the same names without the last
4 caracters, (g7) , (a2) , (k5) like this Dubbo
Darwin
Sydney
In column " C " opposite the towns names I have a distance number 505

220

710
In column cell " A45 " I have the formula
=LEFT(DU!D26,LEN(DU!D26)-RIGHT(4))
which gives me the name of the town wihout the last 4 caracters Dubbo

Darwin

Sydney
In column ' L " I have a lookup function: =VLOOKUP(A45,B2:C250,2,FALSE)
which should give me :- 505 , but it returns #N/A

Can any one help me please

thank you for your time
regards B Gras


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Excel SUM function JoeD Excel Worksheet Functions 7 June 8th 05 04:19 PM
LOOKUP function Heath Excel Worksheet Functions 3 April 29th 05 08:18 PM
Lookup Function Ademar Excel Worksheet Functions 7 November 8th 04 11:50 PM
Vector lookup function GregTh Excel Worksheet Functions 1 November 4th 04 08:34 PM
Another Lookup function, please Butch Excel Worksheet Functions 3 November 3rd 04 08:52 AM


All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"