IrishMist1748
Board Regular
- Joined
- Sep 27, 2010
- Messages
- 131
I have the following formula (VLOOKUP) that compares 2 workbooks (Sheet1 on each) using column A as a common field(id) and merges the data putting the 'Price' info in Book2 in column C of Book1.
Book1:
Book2:
Merged data (column "C" contains formula):
Formula:
My question is: How can I st this up as a macro?
Also, does someone know of a better way to accomplish this?
Thank you!
Book1:
Excel Workbook | ||||
---|---|---|---|---|
A | B | |||
1 | Item ID | Desc | ||
2 | 91101 | U.S. FLAG - BRASS W/GOLD PLATE & RHINESTONES PIN 2.5MM STONE | ||
3 | 110115 | PLAT BGT/PRIN DIA BRIDAL SET D1.00TW | ||
4 | 110122 | 14KWHT HEART SHAPE PAVE DIA RING D.58TW | ||
Sheet1 |
Book2:
Excel Workbook | ||||
---|---|---|---|---|
A | B | |||
1 | Item ID | Price | ||
2 | 91101 | $7.62;QTY | ||
3 | 110115 | $1,650.00;QTY | ||
4 | 110122 | $299.00;QTY | ||
Sheet1 |
Merged data (column "C" contains formula):
Excel Workbook | |||||
---|---|---|---|---|---|
A | B | C | |||
1 | Item ID | Desc | Price | ||
2 | 91101 | U.S. FLAG - BRASS W/GOLD PLATE & RHINESTONES PIN 2.5MM STONE | $7.62;QTY | ||
3 | 110115 | PLAT BGT/PRIN DIA BRIDAL SET D1.00TW | $1,650.00;QTY | ||
4 | 110122 | 14KWHT HEART SHAPE PAVE DIA RING D.58TW | $299.00;QTY | ||
Sheet1 |
Formula:
Code:
=IF(COUNTIF([Book2.xls]Sheet1!$A$1:$A$10000,A1),VLOOKUP(A1,[Book2.xls]Sheet1!$A$1:$B$10000,2,FALSE),"")
Also, does someone know of a better way to accomplish this?
Thank you!
Last edited: