Solved

Merging two records into one in Excel

Posted on 2014-10-20
7
145 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Turn your laptop into a mobile console!

The CV211 Laptop USB Console Adapter provides a direct Laptop-to-Computer connection for fast and easy remote desktop access with no software to install.

 

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Companies keep a much closer eye on costs today, so changing to new Technology – Microsoft Office 365 is the smartest move to take.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

718 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