Am I on the right path

T

Teddy

Hi there,
I have a list of phone numbers by country including number, name and
department and saved them in ranges i.e. a1:b20 = Germany range
a30:b55=France etc

In the second sheet I need to pull in the name and department. I have used
Vlookup which works a treat for one country
=VLOOKUP(P1,'Numbers'!Germany,2,FALSE)

However I wonder how to add if country = france etc then lookup that range
etc for all my countries. Should I use a macro? or IF? or place the
different version of the lookup into each country and copy down?

Thanks, Teddy
 
V

Vijay Chary

Hi Teddy ! :) It would be better (easier) to write a macro with .Find instead
of Worksheerfunction.VLOOKUP to do the job.
 
T

Teddy

Many thanks for your quick answer. Do you have any suggestions how to do
this or could point me to some sample code? Thanks again.T.
 
D

Don Guillett

If the countries are in a column of their own then select the top row of
your data and use

data>filter>autofilter>filter on the column
 
T

Teddy

Don,
Many thanks for your help. Do you mean to first filter by country then
paste in each vlookup changing the named range then copy for that country and
repeat for each country?
Teddy
 
D

Don Guillett

Since I can't see your data, I don't know. Send to my address below if
desired along with full explanation and before/after examples.
 
P

Pete_UK

Try it this way:

=VLOOKUP(P1,'Numbers'!A:B,2,FALSE)

That should look up all the numbers in column A, not just those
related to Germany.

Hope this helps.

Pete
 
T

Teddy

This is great - much more simplified. Didn't realise you could just
reference the columns A:B .
Many thanks,
T
 
P

Pete_UK

You're welcome - glad it worked for you.

Pete

This is great - much more simplified.  Didn't realise you could just
reference the columns A:B .
Many thanks,
T






- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top