vlookup and macro

didilika

New Member
Joined
Feb 11, 2011
Messages
8
Hi... i am looking for a macro that can do the following:

have 2 xls files one called January.xls the other databaseJanuary.xls

i have in january.xls in column a and b -selected serial numbers and names of customers
i have all customers in databaseJanuary.xls with 35columns of information: column A serial numbers , column b-age, column c-favorite food etc....

with macro I wish to copy all data from all 35 columns from datsbasejanuary.xls to my other xls matched by serial number in column A.

is it possible?

i know i could vlookup tha data 1 by 1 but i want a quicker solution.

appreciate the help-code. Di
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
You can use the VLOOKUP() formula to bring the data from one workbook into the other matching on the serial number. No need for a macro. Put in the VLOOKUP formulas across the first row of the January.xls file until all the values appear properly. Then copy those cells down for the rest of the data.

You could create a macro, but it would take way more time than time saved.
 
Upvote 0
jbeaucaire;2835086] how do i vlookup all 35 at the same time.... i just dont want to do it 1 by 1.. thats why i wish to find quicker way.....
 
Upvote 0
You can construct a single VLOOKUP in column B that when copied down and across will adjust itself to pull from other columns in the target workbook.

So, if the workbook is called databaseJanuary.xls sheet1 and the first formula goes in january.xls sheet1 at cell B2 (to grab the value from column B in the other sheet), the formula would be something like this...

=VLOOKUP($A2, '[databaseJanuary.xls]Sheet1'!$E:$AK, 2, 0)

The C2 formula would be:
=VLOOKUP($A2, '[databaseJanuary.xls]Sheet1'!$E:$AK, 3, 0)

These are easy changes to make, but you can use the COLUMN() function to change it for you.

B2: =VLOOKUP($A2, '[databaseJanuary.xls]Sheet1'!$E:$AK, COLUMN(B$1), 0)


Now you can copy that cell to the right and each value should appear. Correct the formatting of the cells as needed, then copy down.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,283
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