?
Solved

Merging two records into one in Excel

Posted on 2014-10-20
7
Medium Priority
?
146 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:Michael Paxton
[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:Michael Paxton
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
Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

 

Author Comment

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

Accepted Solution

by:
Glenn Ray earned 2000 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:Michael Paxton
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:Michael Paxton
ID: 40419452
Glenn provided a phenomenal solution and was kind and understanding in our back and forth discussions.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

777 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