copy and match data from one worksheet into another via script?

D

Dev4me

Hi all
I have two worksheets
2 columns each

The first sheet has ID and Name Column
for example:

Code
-------------------
ID[/B] NAM
193948 Michael
684588 John
535279 Luke
098734 Matthe
-------------------


my 2nd sheet


Code
-------------------
ID NAM
Michael
John
Luke
Matthe
-------------------


How do i use the first sheet to match up the names on the 2nd sheet
and ultimately copy the ID numbers onto the 2nd sheet?
This is just a simplified example. There are thousands of entries.
Thank you if you have any idea
 
D

Dave Peterson

Maybe using =index(match()) would work for you.

Debra Dalgleish's has some notes you may like:
http://www.contextures.com/xlFunctions03.html (for =index(match()))

put this in B2 of sheet2 to return the id from Sheet1 column A.
=index(sheet1!a:a,match(a2,sheet1!b:b,0))


Hi all
I have two worksheets
2 columns each

The first sheet has ID and Name Column
for example:

Code:
--------------------
ID[/B] NAME
193948 Michael
684588 John
535279 Luke
098734 Matthew
--------------------

my 2nd sheet

Code:
--------------------
ID NAME
Michael
John
Luke
Matthew
--------------------

How do i use the first sheet to match up the names on the 2nd sheet
and ultimately copy the ID numbers onto the 2nd sheet?
This is just a simplified example. There are thousands of entries.
Thank you if you have any ideas
 
J

JennyC

Presuming the NAME's are unique - VLOOKUP is what you need:

First - you'll need to swap the ID and the name columns in the 1st sheet as
VLOOKUP works from left to right

Lookup_value = Select the ID in de 2nd sheet
Table_array = Select the column NAME in the first sheet
Col_index_num = 1

Copy down the whole column in the 2nd sheet ...........

Jenny
 
Top