Conditional copy cells from one excel file into current

  • Thread starter Thread starter MichaelS
  • Start date Start date
M

MichaelS

Hello All,

Does a macro (or function or ??) exist to conditionally copy value
from a stored spreadsheet into the current (open) spreadsheet?

Here's the scenario:

Stored spreadsheet is two columnsof text (~200 rows) : Think explici
question in column one, then the correct answer in column two of th
same row.

Then my current (open) spreadsheet has SOME of the same questions i
column one.

I would like to invoke a [macro?] that, in pseudo code, does somethin
similar to the following:

for each row (question in column 1) of the current spreadsheet
Search in column 1 of *stored* spreadsheet for a matching question
IF matched, copy text of column 2 (answer)
into column 2 the current spreadsheet


So each question in my current spreadsheet gets the correct (matching
answer from the stored answer key.

Any help is appreciated. THis will save me oodles of time!

-Michae
 
BTW, a pointer to a good resource would be great! Not nec. the cod
itself. Any help is appreciated. Thanks. -Michae
 
You could do it with worksheet functions.

Take a look at =vlookup()

=vlookup(a1,sheet2!$a$1:$b$300,2,false)

or to hide the #n/a when no match is found:

=if(iserror(vlookup(a1,sheet2!$a$1:$b$300,2,false)),"",
vlookup(a1,sheet2!$a$1:$b$300,2,false))

(all one cell)

then copy down.

MichaelS < said:
Hello All,

Does a macro (or function or ??) exist to conditionally copy values
from a stored spreadsheet into the current (open) spreadsheet?

Here's the scenario:

Stored spreadsheet is two columnsof text (~200 rows) : Think explicit
question in column one, then the correct answer in column two of the
same row.

Then my current (open) spreadsheet has SOME of the same questions in
column one.

I would like to invoke a [macro?] that, in pseudo code, does something
similar to the following:

for each row (question in column 1) of the current spreadsheet
Search in column 1 of *stored* spreadsheet for a matching question
IF matched, copy text of column 2 (answer)
into column 2 the current spreadsheet

So each question in my current spreadsheet gets the correct (matching)
answer from the stored answer key.

Any help is appreciated. THis will save me oodles of time!

-Michael
 
Back
Top