Solved

Merging two records into one in Excel

Posted on 2014-10-20
7
140 Views
Last Modified: 2014-11-03
I have a spreadsheet that contains demographic data.  I need help!  What I'd like to do is merge two rows that contain the same last name and address.  The problem right now is there are two records per provider, and one has a image rec field complete, and the other has the tax id.  I need one record that has both.  In the attached file, the top four rows are the "as is" state, and the bottom two rows are what I'd like it to look like.
Merge-Example.xlsx
0
Comment
Question by:paxtonm
  • 4
  • 3
7 Comments
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40392705
It appears that the data containing the Tax ID is the preferred data and that you only need to populate the IMAGE_RECNBR field.  These steps should work:

1) Create a duplicate copy of your existing worksheet (either [Ctrl]+click-and-drag the sheet tab to a new location or, right-click sheet tab, select "Move or copy...", select (move to end) and click OK)
2) Rename the sheet - say, "Combined"
3) Remove all rows containing a value in the IMAGE_RECNBR field:
    a) Turn on Data Filters (Menu: Data, Sort & Filter section, Filter icon)
    b) Click on filter button for IMAGE_RECNBR field and turn OFF the check box for (Blanks).
    c) Select all visible rows, right-click on selection and click "Delete Rows".
    d) Clear the data filters (Menu: Data, Sort & Filter section, "Clear")
4) In cell D2 (which should be empty), enter the following formula:
=SUMIF(Sheet1!A:A,A2,Sheet1!D:D)  <---replace Sheet1 with your original sheet name
5) Copy down this formula to the bottom of your remaining data.
6) Select all these cells (D2 to bottom), copy again and replace with their values (PasteSpecial, values).

This presumes that there are only two records per individual and that only one record in each pair contains the IMAGE_RECNBR value.

Regards,
-Glenn
EE-Merge-Example.xlsx
0
 

Author Comment

by:paxtonm
ID: 40397659
Glenn,

This worked in some instances, and not in others.  I think this is because there are some Drs. with multiple locations and TaxIDs and ImageRecNmbr.  I have attached a more representative sample.

Thanks,

Michael
Merge-Example-2.xlsx
0
 
LVL 27

Expert Comment

by:Glenn Ray
ID: 40398008
In your example data, only four records would be consolidated:
consolidationand the rest would be unaffected.  Is this correct?

-Glenn
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:paxtonm
ID: 40398362
Correct, and the others should remain with the TaxID field blank.
0
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 500 total points
ID: 40402437
Based on your new example data and your original criteria (last name and address must be the same), here's how you can consolidate the data:

1) [Optional, but recommended] Create a duplicate copy of your existing worksheet (either [Ctrl]+click-and-drag the sheet tab to a new location or, right-click sheet tab, select "Move or copy...", select (move to end) and click OK)
2) Insert a new column to the right of the IMAGE_RECNBR field (in column E).  Enter a new header, like "NEW_IR"
3) Insert this formula in E2 and copy down:
=SUMIFS(D:D,G:G,G2,I:I,I2)
4) Select all these cells (E2 to bottom), copy again and replace with their values (PasteSpecial, values).
5) Remove selected duplicates (Menu: Data, Remove Duplicates)
    a) Click the "Unselect All" button
    b) Select "NEW_IR"
    c) Click the "OK" button.
remove duplicate IR rows6) Delete column D (the old IMAGE_RECNBR column).
7) Change the header in D1 to "IMAGE_RECNBR".

As before, this presumes that there are only two records per individual and that only one record in each pair contains the IMAGE_RECNBR value.

 Regards,
 -Glenn
0
 

Author Comment

by:paxtonm
ID: 40419451
Glenn,

Thanks for going above and beyond in helping me with this issue.  Your solution was great, and far more than could ever be expected.

Thanks again,

Michael
0
 

Author Closing Comment

by:paxtonm
ID: 40419452
Glenn provided a phenomenal solution and was kind and understanding in our back and forth discussions.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Meetings to discuss business process can waste time, and often do .  The meeting's dialog can get confusing when participants have different professional perspectives and backgrounds.  A jointly-developed process picture helps wade through the confu…
As freelancing is becoming more and more common in the tech industry, certain obstacles are proving to be a challenge to those who are used to more traditional, structured employment. This article is meant to help identify such obstacles and offer a…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question