PDA

Click to See Complete Forum and Search --> : Query: Combining two sets of data into one


gstack
Jun 6th, 2006, 04:13 AM
Hi guys,

I've got a question about creating reports in VBA for EXCEL that I was wondering if it could be done. I currently have two sheets with the following forms of information in them:

Sheet 1:

Name, Date , Value
--------------------------------
TAG1, 10-Apr-06, 2.6
TAG2, 11-Apr-06, 1.2
TAG3, 10-Apr-06, 0.3

Sheet 2:

Name, Date, Value
--------------------------------
TAG2, 12-Apr-06, 3.3
TAG4, 15-Apr-06, 5.0
TAG5, 20-Apr-06, 4.7

And I need them to be combined to generate a report in the following format:

Report:

Name, Date1, Date2, Value1, Value2
----------------------------------------------------------------
TAG1, 10-Apr-06,, 2.6,
TAG2, 11-Apr-06, 12-Apr-06, 1.2, 3.3
TAG3, 10-Apr-06,, 0.3,
TAG4,, 15-Apr-06,, 5.0
TAG5,, 20-Apr-06,, 4.7

The problem is that I can't simply combine two sheets together because the names don't exist in the same sheets (i.e. TAG1 is only in sheet1). I tried doing a search statement but it is proving too cumbersome.

Is there an easy solution two combine the two such as arrays, or another method? I'm stuck at the moment :)

Any help would be awesome :bigyello:

Ecniv
Jun 6th, 2006, 06:00 AM
Don't follow why you cannot just cut n paste into a new sheet...?

gstack
Jun 6th, 2006, 07:58 PM
The reason is that I'm trying to automate it. It's meant to generate a report from the first two sheets. The information is actually a lot more complex than I provided, I just simplified it as an example.

Edit: Actually, I just figured it out. Just used arrays and a VLOOKUP table in the end. Thanks.