Grouping Duplicate Records

nsamuels

New Member
Joined
Oct 21, 2015
Messages
15
I have a spreadsheet that list out multiple records. I want to group multiple data to one identifier (which is the phone number). How is that done in excel.

Please help!!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
It would be helpful to get a visual representation of what you data looks like, and what you want it to look like afterwards.

While you cannot upload files to this site, there are tools you can use to post screen images. They are listed in Section B of this link here: http://www.mrexcel.com/forum/board-a...forum-use.html.
Also, there is a Test Here forum on this board that you can use to test out these tools to make sure they are working correctly before using them in your question.
 
Upvote 0
It would be helpful to get a visual representation of what you data looks like, and what you want it to look like afterwards.

While you cannot upload files to this site, there are tools you can use to post screen images. They are listed in Section B of this link here: http://www.mrexcel.com/forum/board-a...forum-use.html.
Also, there is a Test Here forum on this board that you can use to test out these tools to make sure they are working correctly before using them in your question.

[TABLE="width: 636"]
<colgroup><col width="73" style="width:55pt"> <col width="71" style="width:53pt"> <col width="69" style="width:52pt"> <col width="125" style="width:94pt"> <col width="77" style="width:58pt"> <col width="64" style="width:48pt" span="2"> <col width="93" style="width:70pt"> </colgroup><tbody>[TR]
[TD="width: 73, align: left"]ID Number[/TD]
[TD="width: 71, align: left"]First Name[/TD]
[TD="width: 69, align: left"]Last Name[/TD]
[TD="width: 125, align: left"]Address[/TD]
[TD="width: 77, align: left"]City[/TD]
[TD="width: 64, align: left"]Zip[/TD]
[TD="width: 64, align: left"]State[/TD]
[TD="width: 93, align: left"]Items Number[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: left"]Nicole[/TD]
[TD="align: left"]Thomas[/TD]
[TD="align: left"]123 Now Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95811[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: left"]Nicole[/TD]
[TD="align: left"]Thomas[/TD]
[TD="align: left"]123 Now Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99213[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: left"]Nicole[/TD]
[TD="align: left"]Thomas[/TD]
[TD="align: left"]123 Now Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99213[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: left"]Nicole[/TD]
[TD="align: left"]Thomas[/TD]
[TD="align: left"]123 Now Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99212[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: left"]Tim[/TD]
[TD="align: left"]Smith[/TD]
[TD="align: left"]456 Reading Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99213[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: left"]Tim[/TD]
[TD="align: left"]Smith[/TD]
[TD="align: left"]456 Reading Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95810[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: left"]Tim[/TD]
[TD="align: left"]Smith[/TD]
[TD="align: left"]456 Reading Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99212[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: left"]Chris[/TD]
[TD="align: left"]Austin[/TD]
[TD="align: left"]897 Past Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95811[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: left"]Chris[/TD]
[TD="align: left"]Austin[/TD]
[TD="align: left"]897 Past Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95800[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: left"]Chris[/TD]
[TD="align: left"]Austin[/TD]
[TD="align: left"]897 Past Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99213[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: left"]Chris[/TD]
[TD="align: left"]Austin[/TD]
[TD="align: left"]897 Past Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95811[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: left"]Mary[/TD]
[TD="align: left"]Turner[/TD]
[TD="align: left"]4785 Big Hollow Ln.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95810[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: left"]Mary[/TD]
[TD="align: left"]Turner[/TD]
[TD="align: left"]4785 Big Hollow Ln.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99204[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: left"]Mary[/TD]
[TD="align: left"]Turner[/TD]
[TD="align: left"]4785 Big Hollow Ln.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95810[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: left"]Donna[/TD]
[TD="align: left"]Matthew[/TD]
[TD="align: left"]5623 Tinker Bell Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99203[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: left"]Donna[/TD]
[TD="align: left"]Matthew[/TD]
[TD="align: left"]5623 Tinker Bell Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95810[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: left"]Donna[/TD]
[TD="align: left"]Matthew[/TD]
[TD="align: left"]5623 Tinker Bell Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]99213[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: left"]Donna[/TD]
[TD="align: left"]Matthew[/TD]
[TD="align: left"]5623 Tinker Bell Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95810[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: left"]Donna[/TD]
[TD="align: left"]Matthew[/TD]
[TD="align: left"]5623 Tinker Bell Rd.[/TD]
[TD="align: left"]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD="align: left"]FL[/TD]
[TD="align: right"]95810[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
OK, based on that data, what do you want your expected result to look like?
 
Upvote 0
[TABLE="width: 708"]
<colgroup><col width="73" style="width:55pt"> <col width="71" style="width:53pt"> <col width="69" style="width:52pt"> <col width="125" style="width:94pt"> <col width="77" style="width:58pt"> <col width="64" style="width:48pt" span="2"> <col width="165" style="width:124pt"> </colgroup><tbody>[TR]
[TD="width: 73"]ID Number[/TD]
[TD="width: 71"]First Name[/TD]
[TD="width: 69"]Last Name[/TD]
[TD="width: 125"]Address[/TD]
[TD="width: 77"]City[/TD]
[TD="width: 64"]Zip[/TD]
[TD="width: 64"]State[/TD]
[TD="width: 165"]Items Number[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD]Nicole[/TD]
[TD]Thomas[/TD]
[TD]123 Now Rd.[/TD]
[TD]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD]FL[/TD]
[TD]95811 99213 [/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD]Tim[/TD]
[TD]Smith[/TD]
[TD]456 Reading Rd.[/TD]
[TD]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD]FL[/TD]
[TD]99213 95810 99212[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD]Chris[/TD]
[TD]Austin[/TD]
[TD]897 Past Rd.[/TD]
[TD]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD]FL[/TD]
[TD]95811 95800 99213 95811[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD]Mary[/TD]
[TD]Turner[/TD]
[TD]4785 Big Hollow Ln.[/TD]
[TD]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD]FL[/TD]
[TD]95810 99204[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD]Donna[/TD]
[TD]Matthew[/TD]
[TD]5623 Tinker Bell Rd.[/TD]
[TD]Jacksonville[/TD]
[TD="align: right"]32286[/TD]
[TD]FL[/TD]
[TD]99203 95810 99213 95810[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
So, do you want "Items Number" all entered into one single cell?
How do you want them separated? By spaces, commas, etc?
 
Upvote 0
Try this code:
Code:
Sub MyCombine()

    Dim myRow As Long
    
    Application.ScreenUpdating = False

'   Set first row to check
    myRow = 2
    
'   Make sure column H if formatted as Text
    Columns("H:H").NumberFormat = "@"
    
'   Do a text to columns on column H to convert the entries to text
    Columns("H:H").TextToColumns Destination:=Range("H1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 2), TrailingMinusNumbers:=True

'   Remove duplicate records
    Range("A1").CurrentRegion.Select
    ActiveSheet.Range("$A$1:$H$20").RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7 _
        , 8), Header:=xlYes
        
'   Start at top row and keep working down until you get to a blank cell in column A
    Do Until Cells(myRow, "A") = ""
'       Check to see if ID (column A) in row below is same as row above
        If Cells(myRow, "A") = Cells(myRow + 1, "A") Then
'           Combine Item Numbers in column H and delete row underneath
            Cells(myRow, "H") = Cells(myRow, "H") & "," & Cells(myRow + 1, "H")
            Rows(myRow + 1).Delete
        Else
'           Move down one row
            myRow = myRow + 1
        End If
    Loop

    Application.ScreenUpdating = True
    
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,102
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top