View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gareth[_3_] Gareth[_3_] is offline
external usenet poster
 
Posts: 109
Default Get data from one sheet to another

Thanks for this Bob, but I need to do it using VBA. I have tried but get
N/A in cells were the tag doesn't appear on Sheet2.

Can Iserror be used?

Grateful for any help.

Gareth


"Bob Phillips" wrote in message
...
Gareth,

You need VLOOKUP

Assuming Eartag is in column A on both sheets,

column B, sheet1
=VLOOKUP(A1,Sheet2!$A$1:$P$100,8,FALSE) - column H is 8

column P, sheet2
=VLOOKUP(A1,Sheet1!$A$1:$P$1,16,FALSE) - column P is 16

you will have to adjust the ranges and the Eartag column to suit your

actual
columns, and then the offsets to match.

--

HTH

Bob Phillips

"Gareth" wrote in message
...
I have 2 sheets in my file.

The first contains data from database1 and is made up of all cattle on a
farm at present and those which have moved off in the last 3 yeras.

The second contains data from database2 and is made up of cattle that
subsidies have been claimed on in the last 3 years.

Sheet1 may have thousands of records where Sheet2 will have a maximum of

a
few hundred.

The only common field is the animals Eartag. What I want to do is get
information from 2 columns on Sheet2 and place it in Sheet1.

The locations of the columns are as follows:

I want column B on Sheet2 to go into column H on Sheet1 (Column H

already
has data in it).

Then I would like column P on Sheet2 to go into column P on Sheet1(this
column is empty).

Any suggestions gratefully received.

Gareth