Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
WAB
 
Posts: n/a
Default macro to change numbers to names

I need a macro that will convert a list of numbers to a
list of names. On sheet 1 there is a list of numbers 1
through 18 and in the cell next to it is a list of names.
The names are listed in the next cell, i.e., cell b3 is
the number 1 cell c3 is John, cell b4 is the number 2, c4
is the name Joan, etc. On sheet two I have two numbers in
each cell in the range D 11 L 27. The numbers on sheet 2
look like this, 1 - 2, 3 - 4, 5 - 6, etc through 17 - 18.
Once I activate the macro I would like to have sheet 2
look like this; John - Joan, Betty - Roxie, Harry - Wally.
Thanks in advance
  #2   Report Post  
Max
 
Posts: n/a
Default

Perhaps a formula approach might also work/suffice ?

Assume in Sheet1, in B3:C20
is the source list of numbers and names

1 John
2 Joan
3 Betty
4 Roxie
5 Harry
6 Wally
....
....
17 Peter
18 Jane

In Sheet2
---------
Assume the list below is in A2:A5
(the list will be text)

1 - 2
3 - 4
5 - 6
17 - 18

Put in B2:

=IF(A2="","",INDEX(Sheet1!$C$3:$C$20,MATCH(MID(A2, 1,SEARCH("-",A2)-1)+0,Shee
t1!$B$3:$B$20,0))&" -
"&INDEX(Sheet1!$C$3:$C$20,MATCH(MID(A2,SEARCH( "-",A2)+2,99)+0,Sheet1!$B$3:$B
$20,0)))

Copy B2 down

B2:B5 will return:

John - Joan
Betty - Roxie
Harry - Wally
Peter - Jane

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"WAB" wrote in message
...
I need a macro that will convert a list of numbers to a
list of names. On sheet 1 there is a list of numbers 1
through 18 and in the cell next to it is a list of names.
The names are listed in the next cell, i.e., cell b3 is
the number 1 cell c3 is John, cell b4 is the number 2, c4
is the name Joan, etc. On sheet two I have two numbers in
each cell in the range D 11 L 27. The numbers on sheet 2
look like this, 1 - 2, 3 - 4, 5 - 6, etc through 17 - 18.
Once I activate the macro I would like to have sheet 2
look like this; John - Joan, Betty - Roxie, Harry - Wally.
Thanks in advance



  #3   Report Post  
wally667
 
Posts: n/a
Default

Max, thank you very much, works great.
wab

"Max" wrote:

Perhaps a formula approach might also work/suffice ?

Assume in Sheet1, in B3:C20
is the source list of numbers and names

1 John
2 Joan
3 Betty
4 Roxie
5 Harry
6 Wally
....
....
17 Peter
18 Jane

In Sheet2
---------
Assume the list below is in A2:A5
(the list will be text)

1 - 2
3 - 4
5 - 6
17 - 18

Put in B2:

=IF(A2="","",INDEX(Sheet1!$C$3:$C$20,MATCH(MID(A2, 1,SEARCH("-",A2)-1)+0,Shee
t1!$B$3:$B$20,0))&" -
"&INDEX(Sheet1!$C$3:$C$20,MATCH(MID(A2,SEARCH( "-",A2)+2,99)+0,Sheet1!$B$3:$B
$20,0)))

Copy B2 down

B2:B5 will return:

John - Joan
Betty - Roxie
Harry - Wally
Peter - Jane

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"WAB" wrote in message
...
I need a macro that will convert a list of numbers to a
list of names. On sheet 1 there is a list of numbers 1
through 18 and in the cell next to it is a list of names.
The names are listed in the next cell, i.e., cell b3 is
the number 1 cell c3 is John, cell b4 is the number 2, c4
is the name Joan, etc. On sheet two I have two numbers in
each cell in the range D 11 L 27. The numbers on sheet 2
look like this, 1 - 2, 3 - 4, 5 - 6, etc through 17 - 18.
Once I activate the macro I would like to have sheet 2
look like this; John - Joan, Betty - Roxie, Harry - Wally.
Thanks in advance




  #4   Report Post  
Max
 
Posts: n/a
Default

You're welcome !
Glad it worked for you
Thanks for posting back ..
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"wally667" wrote in message
...
Max, thank you very much, works great.
wab



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
sorting names alphabetically when names may start with numbers John Smith Excel Discussion (Misc queries) 3 May 11th 05 08:06 PM
Using Macro to Sort Names, Numbers & addresses Tareq Excel Worksheet Functions 1 March 1st 05 02:08 PM
Recorded macro: What happens if I change filename? [email protected] Excel Discussion (Misc queries) 2 January 26th 05 11:54 PM
Random Numbers Change? Les Coover Excel Worksheet Functions 2 December 17th 04 02:49 AM
how do you change invoice numbers automaticly wendy New Users to Excel 1 December 11th 04 12:42 AM


All times are GMT +1. The time now is 12:50 AM.

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

About Us

"It's about Microsoft Excel"