#1   Report Post  
Lori
 
Posts: n/a
Default Combining Data

I have a question I am hoping someone can help me with. I have 2 worksheets
that I need to merge the data. Both have a common field that I key on, Case
ID. If the Case ID is found in both worksheets, the data will be pulled from
worksheet 2. If the Case ID is exists in worksheet 1 but not 2, the data is
pulled from worksheet 1. If the Case ID exists in worksheet 2 but not 1, the
data is pulled from worksheet 2.
Basically, I am exporting data from a system that only gives me current
data. That file may contain existing cases or new cases that the old file
does not. The old file may contain older cases that the new file does not.
I need to retain the old, update the existing and add the new.
Thanks for the help!
  #2   Report Post  
Duke Carey
 
Posts: n/a
Default

Sounds as though you should use worksheet 2 as your 'master,' and copy into
it all the rows in worksheet 1 that are missing from 2. To determine which
ones to copy, insert a new helper col in worksheet1 next to the CaseID
column. In the new column, use a COUNTIF() formula to determine if the
CaseID is in the Master sheet. Assuming the helper column is col A, the case
IDs are in col B on wrksheet 1 and col A on wrksheet 2, use this formula in
cell A2:

=COUNTIF(Worksheet2_Name!A:A,B2)

Copy that formula down to the end of your data, then sort on col A.
Anything with a formula result of 0 is missing from worksheet 2. Copy all
those rows and paste them into worksheet 2



"Lori" wrote:

I have a question I am hoping someone can help me with. I have 2 worksheets
that I need to merge the data. Both have a common field that I key on, Case
ID. If the Case ID is found in both worksheets, the data will be pulled from
worksheet 2. If the Case ID is exists in worksheet 1 but not 2, the data is
pulled from worksheet 1. If the Case ID exists in worksheet 2 but not 1, the
data is pulled from worksheet 2.
Basically, I am exporting data from a system that only gives me current
data. That file may contain existing cases or new cases that the old file
does not. The old file may contain older cases that the new file does not.
I need to retain the old, update the existing and add the new.
Thanks for the help!

  #3   Report Post  
Lori
 
Posts: n/a
Default

This would work except that I need this to be automated. The data will be
exported daily. Therefore the new worksheet would become the old each day.
In addition, there are numerous pivot tables reporting off of the worksheet.
We would like to be able to just push a button and the data merge together
rather than have a manual process.

"Duke Carey" wrote:

Sounds as though you should use worksheet 2 as your 'master,' and copy into
it all the rows in worksheet 1 that are missing from 2. To determine which
ones to copy, insert a new helper col in worksheet1 next to the CaseID
column. In the new column, use a COUNTIF() formula to determine if the
CaseID is in the Master sheet. Assuming the helper column is col A, the case
IDs are in col B on wrksheet 1 and col A on wrksheet 2, use this formula in
cell A2:

=COUNTIF(Worksheet2_Name!A:A,B2)

Copy that formula down to the end of your data, then sort on col A.
Anything with a formula result of 0 is missing from worksheet 2. Copy all
those rows and paste them into worksheet 2



"Lori" wrote:

I have a question I am hoping someone can help me with. I have 2 worksheets
that I need to merge the data. Both have a common field that I key on, Case
ID. If the Case ID is found in both worksheets, the data will be pulled from
worksheet 2. If the Case ID is exists in worksheet 1 but not 2, the data is
pulled from worksheet 1. If the Case ID exists in worksheet 2 but not 1, the
data is pulled from worksheet 2.
Basically, I am exporting data from a system that only gives me current
data. That file may contain existing cases or new cases that the old file
does not. The old file may contain older cases that the new file does not.
I need to retain the old, update the existing and add the new.
Thanks for the help!

  #4   Report Post  
Duke Carey
 
Posts: n/a
Default

What you're looking for is a carefully written VBA routine that automates
pretty much the same steps that I described, but includes error checking and
validation. The approach taken may be dictated by the layout of your
worksheets and the volume of data.

Perhaps starting a new post with some samples of the data would allow
somebody here to give concise pointers on how to apporach this.

Good luck


"Lori" wrote:

This would work except that I need this to be automated. The data will be
exported daily. Therefore the new worksheet would become the old each day.
In addition, there are numerous pivot tables reporting off of the worksheet.
We would like to be able to just push a button and the data merge together
rather than have a manual process.

"Duke Carey" wrote:

Sounds as though you should use worksheet 2 as your 'master,' and copy into
it all the rows in worksheet 1 that are missing from 2. To determine which
ones to copy, insert a new helper col in worksheet1 next to the CaseID
column. In the new column, use a COUNTIF() formula to determine if the
CaseID is in the Master sheet. Assuming the helper column is col A, the case
IDs are in col B on wrksheet 1 and col A on wrksheet 2, use this formula in
cell A2:

=COUNTIF(Worksheet2_Name!A:A,B2)

Copy that formula down to the end of your data, then sort on col A.
Anything with a formula result of 0 is missing from worksheet 2. Copy all
those rows and paste them into worksheet 2



"Lori" wrote:

I have a question I am hoping someone can help me with. I have 2 worksheets
that I need to merge the data. Both have a common field that I key on, Case
ID. If the Case ID is found in both worksheets, the data will be pulled from
worksheet 2. If the Case ID is exists in worksheet 1 but not 2, the data is
pulled from worksheet 1. If the Case ID exists in worksheet 2 but not 1, the
data is pulled from worksheet 2.
Basically, I am exporting data from a system that only gives me current
data. That file may contain existing cases or new cases that the old file
does not. The old file may contain older cases that the new file does not.
I need to retain the old, update the existing and add the new.
Thanks for the help!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort pages? David Excel Discussion (Misc queries) 15 May 13th 05 11:33 PM
Help making a chart that doesn't graph cells without data? Filtration Guy Excel Discussion (Misc queries) 0 March 22nd 05 09:21 PM
Adding more source data to existing scatter plot Tom Charts and Charting in Excel 1 March 21st 05 10:03 PM
Combining data (numeric format) in multiple cells into one cell (t GNAC SID Excel Discussion (Misc queries) 2 February 7th 05 04:09 PM
Combining conditions for data entry validation Richard H Knoff Excel Worksheet Functions 10 November 14th 04 01:49 PM


All times are GMT +1. The time now is 09:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"