Make list from multiple lists

imanew

New Member
Joined
Mar 15, 2010
Messages
43
I currently have this:

Excel Workbook
ABCDEFGH
1a1*b4*e7
2c2*f2*g2
3d1*h3*i5
4********
5a*******
6b*******
7c*******
8d*******
9e*******
10f*******
11g*******
12h*******
13i*******
Sheet1


What i want is column B to be filled with the numbers that relate to the corresponding letter.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
In B5 enter =IFERROR(VLOOKUP(A5,$A$1:$B$3,2,FALSE),IFERROR(VLOOKUP(A5,$D$1:$E$3,2,FALSE),VLOOKUP(A5,$G$1:$H$3,2,FALSE)))

Copy B5 as far down as you have data in A.
 
Upvote 0
imanew,


Sample data before the macro:


Excel Workbook
ABCDEFGH
1a1b4e7
2c2f2g2
3d1h3i5
4
5a
6b
7c
8d
9e
10f
11g
12h
13i
14
Sheet1





After the macro:


Excel Workbook
ABCDEFGH
1a1b4e7
2c2f2g2
3d1h3i5
4
5a1
6b4
7c2
8d1
9e7
10f2
11g2
12h3
13i5
14
Sheet1





Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
2. Open your workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


Code:
Option Explicit
Sub FindNumbers()
' hiker95, 04/25/2011
' http://www.mrexcel.com/forum/showthread.php?t=546041
Dim c As Range, rng As Range, d As Range
Application.ScreenUpdating = False
Set rng = Range("A1:H3")
For Each c In Range("A5", Range("A" & Rows.Count).End(xlUp))
  With rng
    Set d = .Find(c, LookIn:=xlValues, LookAt:=xlWhole)
    On Error Resume Next
    c.Offset(, 1).Value = d.Offset(, 1).Value
    On Error GoTo 0
  End With
Next c
Application.ScreenUpdating = True
End Sub


Then run the FindNumbers macro.
 
Upvote 0
the only issue with this is that the 3 different columns are on different worksheets. so i cant use "A1:H3" it will need to incorporate all 3 sheets.
 
Upvote 0
In B5 enter =IFERROR(VLOOKUP(A5,$A$1:$B$3,2,FALSE),IFERROR(VLOOKUP(A5,$D$1:$E$3,2,FALSE),VLOOKUP(A5,$G$1:$H$3,2,FALSE)))

Copy B5 as far down as you have data in A.

Say there was a column between a and b with data in it how would i get around this?
 
Upvote 0
How do i get this formula to work if there is data between the two columns? we are looking up. I just figured it out. i just have 3 instead of 2 and extend the array around all three columns
 
Upvote 0
Good for you. Isn't there a certain charm to discovering a solution for yourself? :)
How do i get this formula to work if there is data between the two columns? we are looking up. I just figured it out. i just have 3 instead of 2 and extend the array around all three columns
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top