English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

If doc 1 has data in columns a & b that match data in columns a & b in doc 2, what macro can I insert that will populate column c in doc 1 with the data in column c from doc 2?

2007-02-13 03:36:21 · 5 answers · asked by brad 2 in Computers & Internet Software

5 answers

If by doc 1 and doc 2 you mean two different excel workbooks, then, first thing is that you will need a slightly different formula, besides, just having a formula wouldn't work.

Since you are not talking about the copying the contents of Col C from doc 2 and pasting them into Col C of doc1, I presume that you are expecting dynamic changes, i.e. whenever a value in Col C of doc 2 is added/updated, you want the changes to reflect in Col C of doc 1. The above given formula or the following will work if doc1 and doc2 are sheets in the same excel workbook:

In cell C1 of doc 1 type:
= IF(doc2!C1 > 0, doc2!C1, "")

then copy and paste this formula in as many number of rows you like in Col C of doc 1...

If doc 1 and doc 2 are two different workbooks, then you will need this formula (presuming Sheet1 on both workbooks contains data)

= IF( '[doc2.xls]Sheet1'!C1>0, '[doc2.xls]Sheet1'!C1, "" )

The values in doc 1 will not refresh automatically... to refresh values in doc 1 in this case, you will have to momentarily open doc 2 while doc 1 is open... and then close it.

.

2007-02-13 03:51:56 · answer #1 · answered by SmartSpider 4 · 0 0

Why a macro? Just use a formula like this in column c1 of sheet 1:

=IF(A1=Sheet2!A1, Sheet2!C1, NULL)

This assumes the second sheet is named "Sheet2" (the default name).

2007-02-13 03:44:31 · answer #2 · answered by BigRez 6 · 0 0

You should be able to do that with the VLOOKUP formula, see the Help for the syntax...

2007-02-13 03:49:18 · answer #3 · answered by ZiggyCool 2 · 0 0

In column c of Doc1...=IF(AND(A2=Doc2!A2,Doc1!B2=Doc2!B2),Doc2!C2,"")

2007-02-13 03:50:24 · answer #4 · answered by Anonymous · 0 0

yes, you can make marco in office

2007-02-13 03:45:47 · answer #5 · answered by Anonymous · 0 0

fedest.com, questions and answers