Create a single row for duplicate rows based on two columns (Not One)

CramitCCCAs

New Member
Joined
Oct 18, 2005
Messages
14
Attached data has an identifier in column A, Column C has the plan description and column B has the matching percentage that goes with the plan. I need separate columns for the "Bonus Plan" (Column C) but the cell values need to be populated with the data in "Bonus Plan Assignment" (Column B)

EE Data.xlsx
ABC
1Employee IDBonus Plan AssignmentBonus Plan
2100268510% Annual: Individual TargetIndividual Bonus Objectives (IBO)
3100269249% Annual: Individual TargetIndividual Bonus Objectives (IBO)
4100270314% Annual: Individual TargetIndividual Bonus Objectives (IBO)
5100270612% Annual: Individual TargetIndividual Bonus Objectives (IBO)
6100271714% Annual: Individual TargetIndividual Bonus Objectives (IBO)
7100271914% Annual: Individual TargetIndividual Bonus Objectives (IBO)
850705011.76% Annual: Individual TargetIndividual Bonus Objectives (IBO)
9100227010% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1050704210% Annual: Individual TargetIndividual Bonus Objectives (IBO)
11100255010% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1250731413% Annual: Individual TargetIndividual Bonus Objectives (IBO)
135077245% Annual: Individual TargetIndividual Bonus Objectives (IBO)
145077245% Quarterly: Individual TargetCorporate Earnings (CE)
1510017597% Annual: Individual TargetIndividual Bonus Objectives (IBO)
16100273625% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1710052062.22% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1810052062.24% Quarterly: Individual TargetResuscitation Earnings (RE)
190059609% Annual: Individual TargetIndividual Bonus Objectives (IBO)
20100159912.5% Quarterly: Individual TargetBusiness Achievement (BA) Public Safety
2110015995% Annual: Individual TargetIndividual Bonus Objectives (IBO)
2210015997.5% Quarterly: Individual TargetResuscitation Earnings (RE)
2350718810% Annual: Individual TargetIndividual Bonus Objectives (IBO)
245071885% Quarterly: Individual TargetResuscitation Earnings (RE)
255078233.75% Annual: Individual TargetIndividual Bonus Objectives (IBO)
265078233.75% Quarterly: Individual TargetBusiness Achievement (BA) EMS
275078233.75% Quarterly: Individual TargetBusiness Achievement (BA) - Hospital
285078233.75% Quarterly: Individual TargetResuscitation Earnings (RE)
2950731611% Quarterly: Individual TargetResuscitation Earnings (RE)
3050731617% Annual: Individual TargetIndividual Bonus Objectives (IBO)
31100267128% Annual: Individual TargetIndividual Bonus Objectives (IBO)
3210046315% Annual: Individual TargetIndividual Bonus Objectives (IBO)
335072775% Annual: Individual TargetIndividual Bonus Objectives (IBO)
345072775% Quarterly: Individual TargetResuscitation Earnings (RE)
355072689% Annual: Individual TargetIndividual Bonus Objectives (IBO)
36100310124% Annual: Individual TargetIndividual Bonus Objectives (IBO)
3750721110% Annual: Individual TargetIndividual Bonus Objectives (IBO)
385072115% Quarterly: Individual TargetResuscitation Earnings (RE)
3910028647.93% Annual: Individual TargetIndividual Bonus Objectives (IBO)
40100485310% Annual: Individual TargetIndividual Bonus Objectives (IBO)
41100266549% Annual: Individual TargetIndividual Bonus Objectives (IBO)
4210037765% Quarterly: Individual TargetResuscitation Earnings (RE)
430054588% Annual: Individual TargetIndividual Bonus Objectives (IBO)
440054588% Quarterly: Individual TargetResuscitation Earnings (RE)
4500573310% Quarterly: Individual TargetResuscitation Earnings (RE)
4600573320% Annual: Individual TargetIndividual Bonus Objectives (IBO)
4750751412% Annual: Individual TargetIndividual Bonus Objectives (IBO)
4810027885.22% Annual: Individual TargetIndividual Bonus Objectives (IBO)
495077328% Annual: Individual TargetIndividual Bonus Objectives (IBO)
5050763710% Annual: Individual TargetIndividual Bonus Objectives (IBO)
515076375% Quarterly: Individual TargetResuscitation Earnings (RE)
525078245% Annual: Individual TargetIndividual Bonus Objectives (IBO)
535078245% Quarterly: Individual TargetResuscitation Earnings (RE)
54100515012% Annual: Individual TargetIndividual Bonus Objectives (IBO)
5550727410% Annual: Individual TargetIndividual Bonus Objectives (IBO)
5600568212% Annual: Individual TargetIndividual Bonus Objectives (IBO)
5710027847.53% Annual: Individual TargetIndividual Bonus Objectives (IBO)
5810028618.61% Annual: Individual TargetIndividual Bonus Objectives (IBO)
5910028618.61% Quarterly: Individual TargetResuscitation Earnings (RE)
6010028618.61% Quarterly: Individual TargetBusiness Achievement (BA) - Hospital
6150738719.3% Annual: Individual TargetIndividual Bonus Objectives (IBO)
625073877.7% Quarterly: Individual TargetResuscitation Earnings (RE)
6310028245.45% Annual: Individual TargetIndividual Bonus Objectives (IBO)
6410030163.2% Annual: Individual TargetIndividual Bonus Objectives (IBO)
6510030164.79% Quarterly: Individual TargetResuscitation Earnings (RE)
665078545% Annual: Individual TargetIndividual Bonus Objectives (IBO)
675078545% Quarterly: Individual TargetResuscitation Earnings (RE)
68100201310% Annual: Individual TargetIndividual Bonus Objectives (IBO)
69100201310% Quarterly: Individual TargetCorporate Earnings (CE)
7000611913% Annual: Individual TargetIndividual Bonus Objectives (IBO)
71100298030.37% Annual: Individual TargetIndividual Bonus Objectives (IBO)
72100298038.65% Quarterly: Individual TargetResuscitation Earnings (RE)
735074059% Annual: Individual TargetIndividual Bonus Objectives (IBO)
740059004% Quarterly: Individual TargetResuscitation Earnings (RE)
750059008% Annual: Individual TargetIndividual Bonus Objectives (IBO)
765077376% Annual: Individual TargetIndividual Bonus Objectives (IBO)
7710012276% Annual: Individual TargetIndividual Bonus Objectives (IBO)
7810012276% Quarterly: Individual TargetResuscitation Earnings (RE)
79100001810% Annual: Individual TargetIndividual Bonus Objectives (IBO)
8010050785% Annual: Individual TargetIndividual Bonus Objectives (IBO)
8110050785% Quarterly: Individual TargetCorporate Earnings (CE)
8210021007% Annual: Individual TargetIndividual Bonus Objectives (IBO)
8310029812.72% Quarterly: Individual TargetResuscitation Earnings (RE)
8410029814.07% Annual: Individual TargetIndividual Bonus Objectives (IBO)
855075448% Annual: Individual TargetIndividual Bonus Objectives (IBO)
8610029322.64% Annual: Individual TargetIndividual Bonus Objectives (IBO)
8710029323.88% Quarterly: Individual TargetResuscitation Earnings (RE)
8810029405.25% Annual: Individual TargetIndividual Bonus Objectives (IBO)
8910029407.88% Quarterly: Individual TargetResuscitation Earnings (RE)
905072387% Annual: Individual TargetIndividual Bonus Objectives (IBO)
910059785% Annual: Individual TargetIndividual Bonus Objectives (IBO)
920059785% Quarterly: Individual TargetCorporate Earnings (CE)
9310029823% Annual: Individual TargetIndividual Bonus Objectives (IBO)
9410029824.55% Quarterly: Individual TargetResuscitation Earnings (RE)
9500609017% Annual: Individual TargetIndividual Bonus Objectives (IBO)
96100499110.53% Annual: Individual TargetIndividual Bonus Objectives (IBO)
970058407% Annual: Individual TargetIndividual Bonus Objectives (IBO)
981075548% Annual: Individual TargetIndividual Bonus Objectives (IBO)
9950710010% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1005071005% Quarterly: Individual TargetResuscitation Earnings (RE)
10100593910% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1020059395% Quarterly: Individual TargetResuscitation Earnings (RE)
10310028093.23% Annual: Individual TargetIndividual Bonus Objectives (IBO)
10410028095.1% Quarterly: Individual TargetResuscitation Earnings (RE)
10510042425% Annual: Individual TargetIndividual Bonus Objectives (IBO)
10610048547% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1072001462.5% Quarterly: Individual TargetBusiness Achievement (BA) - Hospital
1082001467.5% Annual: Individual TargetIndividual Bonus Objectives (IBO)
109100472810% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1101075384% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1111075384% Quarterly: Individual TargetResuscitation Earnings (RE)
1120059519% Annual: Individual TargetIndividual Bonus Objectives (IBO)
113100491013.43% Annual: Individual TargetIndividual Bonus Objectives (IBO)
11410049108.96% Quarterly: Individual TargetResuscitation Earnings (RE)
11510021146% Annual: Individual TargetIndividual Bonus Objectives (IBO)
11610030943.72% Annual: Individual TargetIndividual Bonus Objectives (IBO)
11710030945.59% Quarterly: Individual TargetResuscitation Earnings (RE)
11800618814% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1190061886% Quarterly: Individual TargetResuscitation Earnings (RE)
1205074515% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1215074515% Quarterly: Individual TargetResuscitation Earnings (RE)
12210048559% Annual: Individual TargetIndividual Bonus Objectives (IBO)
12300538710% Quarterly: Individual TargetResuscitation Earnings (RE)
12400538720% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1250050628.32% Annual: Individual TargetIndividual Bonus Objectives (IBO)
12600565517% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1275074997% Annual: Individual TargetIndividual Bonus Objectives (IBO)
128100273924% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1295075689% Annual: Individual TargetIndividual Bonus Objectives (IBO)
130100133612% Annual: Individual TargetIndividual Bonus Objectives (IBO)
13110026327% Annual: Individual TargetIndividual Bonus Objectives (IBO)
132100278510.12% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1335075997% Annual: Individual TargetIndividual Bonus Objectives (IBO)
13410046995% Annual: Individual TargetIndividual Bonus Objectives (IBO)
13510046995% Quarterly: Individual TargetResuscitation Earnings (RE)
13650724912% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1375074895% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1385075523.62% Quarterly: Individual TargetResuscitation Earnings (RE)
1395075529.05% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1405075529.05% Quarterly: Individual TargetBusiness Achievement (BA) Public Safety
14150726010% Annual: Individual TargetIndividual Bonus Objectives (IBO)
14210051134.53% Annual: Individual TargetIndividual Bonus Objectives (IBO)
14310051136.8% Quarterly: Individual TargetResuscitation Earnings (RE)
14400558410% Annual: Individual TargetIndividual Bonus Objectives (IBO)
14500558414% Quarterly: Individual TargetResuscitation Earnings (RE)
1465074068% Annual: Individual TargetIndividual Bonus Objectives (IBO)
14750749512% Annual: Individual TargetIndividual Bonus Objectives (IBO)
148100165010% Annual: Individual TargetIndividual Bonus Objectives (IBO)
14950776315% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1505077635% Quarterly: Individual TargetResuscitation Earnings (RE)
15110047444% Annual: Individual TargetIndividual Bonus Objectives (IBO)
15210047444% Quarterly: Individual TargetCorporate Earnings (CE)
15350757010% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1540052787% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1550053627% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1565076299% Annual: Individual TargetIndividual Bonus Objectives (IBO)
157100275428% Annual: Individual TargetIndividual Bonus Objectives (IBO)
15810048567% Annual: Individual TargetIndividual Bonus Objectives (IBO)
15950719010% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1605071905% Quarterly: Individual TargetResuscitation Earnings (RE)
16110027817% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1625071469% Annual: Individual TargetIndividual Bonus Objectives (IBO)
16310026347% Annual: Individual TargetIndividual Bonus Objectives (IBO)
164100275128% Annual: Individual TargetIndividual Bonus Objectives (IBO)
165100275510.5% Annual: Individual TargetIndividual Bonus Objectives (IBO)
166100272614% Annual: Individual TargetIndividual Bonus Objectives (IBO)
167100274624% Annual: Individual TargetIndividual Bonus Objectives (IBO)
168100268332% Annual: Individual TargetIndividual Bonus Objectives (IBO)
16910051305% Annual: Individual TargetIndividual Bonus Objectives (IBO)
17010051305% Quarterly: Individual TargetCorporate Earnings (CE)
1710015785% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1725071358.33% Annual: Individual TargetIndividual Bonus Objectives (IBO)
17310744810% Annual: Individual TargetIndividual Bonus Objectives (IBO)
174100532410% Annual: Individual TargetIndividual Bonus Objectives (IBO)
17510030004.86% Annual: Individual TargetIndividual Bonus Objectives (IBO)
17610030007.19% Quarterly: Individual TargetResuscitation Earnings (RE)
1775076935% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1785076935% Quarterly: Individual TargetResuscitation Earnings (RE)
17910029433.33% Quarterly: Individual TargetResuscitation Earnings (RE)
18010029436.2% Annual: Individual TargetIndividual Bonus Objectives (IBO)
18110051602.5% Quarterly: Individual TargetBusiness Achievement (BA) Public Safety
18210051607.5% Annual: Individual TargetIndividual Bonus Objectives (IBO)
18300570511% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1840057054% Quarterly: Individual TargetResuscitation Earnings (RE)
18510014025% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1868018384% Quarterly: Individual TargetResuscitation Earnings (RE)
1878018386% Annual: Individual TargetIndividual Bonus Objectives (IBO)
1885073804% Quarterly: Individual TargetResuscitation Earnings (RE)
1895073808% Annual: Individual TargetIndividual Bonus Objectives (IBO)
190100231710% Annual: Individual TargetIndividual Bonus Objectives (IBO)
19110023175% Quarterly: Individual TargetResuscitation Earnings (RE)
19210048579% Annual: Individual TargetIndividual Bonus Objectives (IBO)
193100290511.75% Quarterly: Individual TargetResuscitation Earnings (RE)
19410029052.94% Annual: Individual TargetIndividual Bonus Objectives (IBO)
19510028663.94% Annual: Individual TargetIndividual Bonus Objectives (IBO)
19610028667.33% Quarterly: Individual TargetResuscitation Earnings (RE)
19710049601.25% Quarterly: Individual TargetBusiness Achievement (BA) - Hospital
19810049601.25% Quarterly: Individual TargetBusiness Achievement (BA) EMS
19910049607.5% Annual: Individual TargetIndividual Bonus Objectives (IBO)
2005071785% Annual: Individual TargetIndividual Bonus Objectives (IBO)
2015071785% Quarterly: Individual TargetCorporate Earnings (CE)
EE Data
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Like this?

1625606112782.png


Or with the Bonus plan as headers in new columns?
 
Upvote 0
Sorry, no. I wasn't as clear as I needed to be. One column for each separate value in in Column C (6 different plans) populated with the corresponding value Column B.
 
Upvote 0
Like this then?

VBA Code:
Sub Macro2()

Dim rownum As Long
Dim rownum2 As Long
Dim colnum As Long
Dim success As Long
Dim Bonus As String
Dim BonusPlan As String

    Range(Range("C1"), Range("C1").End(xlDown)).Copy Range("F1")
    Range(Range("F1"), Range("F1").End(xlDown)).RemoveDuplicates Columns:=1, Header:=xlYes
    Range(Range("F1"), Range("F1").End(xlDown)).Copy
    Range("G1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Columns("F:F").Delete Shift:=xlToLeft
   
rownum = 2
Do Until Cells(rownum, 1) = ""
Bonus = Cells(rownum, 3)
BonusPlan = Cells(rownum, 2)
colnum = 7
    Do Until Cells(1, colnum) = Bonus
        colnum = colnum + 1
    Loop
        rownum2 = 2
        success = 0
            Do Until success = 1
                If Cells(rownum2, colnum) = BonusPlan Then
                success = 1
                ElseIf Cells(rownum2, colnum) = "" Then
                Cells(rownum2, colnum) = BonusPlan
                success = 1
                End If
            rownum2 = rownum2 + 1
            Loop
rownum = rownum + 1
Loop
           
End Sub

*examples are always helpful

1625607270874.png
 
Last edited:
Upvote 0
I tried the code, but it errored looking for an end sub? Sorry about not providing an example I'll be sure to include one next time!
 
Upvote 0
After adding the End Sub it did create the columns and added the values but the identifiers were ignored, so its not really what I was looking for. Ideally I need a single value for Column A where there are duplicates, then a column each for the corresponding values in Column C populated with the values in Column B. Sorry for my confusion and lack of detail. The rows in Yellow would be deleted.

EE Data2.xlsm
ABCDEFGHIJKL
1Employee IDBonus Plan AssignmentBonus PlanIndividual Bonus Objectives (IBO)Corporate Earnings (CE)Resuscitation Earnings (RE)Business Achievement (BA) Public SafetyBusiness Achievement (BA) EMSBusiness Achievement (BA) - HospitalBusiness Achievement (BA) VentilationBusiness Achievement (BA) MilitaryBusiness Achievement (BA)
2100268510% Annual: Individual TargetIndividual Bonus Objectives (IBO)10% Annual: Individual Target
3100269249% Annual: Individual TargetIndividual Bonus Objectives (IBO)49% Annual: Individual Target
4100270314% Annual: Individual TargetIndividual Bonus Objectives (IBO)14% Annual: Individual Target
5100270612% Annual: Individual TargetIndividual Bonus Objectives (IBO)12% Annual: Individual Target
6100271714% Annual: Individual TargetIndividual Bonus Objectives (IBO)14% Annual: Individual Target
7100271914% Annual: Individual TargetIndividual Bonus Objectives (IBO)14% Annual: Individual Target
850705011.76% Annual: Individual TargetIndividual Bonus Objectives (IBO)11.76% Annual: Individual Target
9100227010% Annual: Individual TargetIndividual Bonus Objectives (IBO)10% Annual: Individual Target
1050704210% Annual: Individual TargetIndividual Bonus Objectives (IBO)10% Annual: Individual Target
11100255010% Annual: Individual TargetIndividual Bonus Objectives (IBO)10% Annual: Individual Target
1250731413% Annual: Individual TargetIndividual Bonus Objectives (IBO)13% Annual: Individual Target
135077245% Annual: Individual TargetIndividual Bonus Objectives (IBO)5% Annual: Individual Target5% Quarterly: Individual Target
145077245% Quarterly: Individual TargetCorporate Earnings (CE)
1510017597% Annual: Individual TargetIndividual Bonus Objectives (IBO)7% Annual: Individual Target
16100273625% Annual: Individual TargetIndividual Bonus Objectives (IBO)25% Annual: Individual Target
1710052062.22% Annual: Individual TargetIndividual Bonus Objectives (IBO)2.22% Annual: Individual Target2.24% Quarterly: Individual Target
1810052062.24% Quarterly: Individual TargetResuscitation Earnings (RE)
190059609% Annual: Individual TargetIndividual Bonus Objectives (IBO)Individual Bonus Objectives (IBO)
20100159912.5% Quarterly: Individual TargetBusiness Achievement (BA) Public Safety5% Annual: Individual Target7.5% Quarterly: Individual Target12.5% Quarterly: Individual Target
2110015995% Annual: Individual TargetIndividual Bonus Objectives (IBO)
2210015997.5% Quarterly: Individual TargetResuscitation Earnings (RE)
EE Data
 
Upvote 0
So remove duplicates in A, then the rest should work?

VBA Code:
Sub Macro2()

Dim rownum As Long
Dim rownum2 As Long
Dim colnum As Long
Dim success As Long
Dim Bonus As String
Dim BonusPlan As String

    Range(Range("A1"), Range("C1").End(xlDown)).RemoveDuplicates Columns:=1, Header:=xlYes
    Range(Range("C1"), Range("C1").End(xlDown)).Copy Range("F1")
    Range(Range("F1"), Range("F1").End(xlDown)).RemoveDuplicates Columns:=1, Header:=xlYes
    Range(Range("F1"), Range("F1").End(xlDown)).Copy
    Range("G1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Columns("F:F").Delete Shift:=xlToLeft
   
rownum = 2
Do Until Cells(rownum, 1) = ""
Bonus = Cells(rownum, 3)
BonusPlan = Cells(rownum, 2)
colnum = 7
    Do Until Cells(1, colnum) = Bonus
        colnum = colnum + 1
    Loop
        rownum2 = 2
        success = 0
            Do Until success = 1
                If Cells(rownum2, colnum) = BonusPlan Then
                success = 1
                ElseIf Cells(rownum2, colnum) = "" Then
                Cells(rownum2, colnum) = BonusPlan
                success = 1
                End If
            rownum2 = rownum2 + 1
            Loop
rownum = rownum + 1
Loop

Columns("D:F").Delete Shift:=xlToLeft

End Sub
 
Upvote 0
Thanks again, however I haven't put us on the same page. The duplicates can't just be deleted, they correspond to the values needed in each row. I'm not trying to parse, I'm trying to lineup a single value for Column A where the values for "B" & "C" are in a single row but match, rather then being listed multiple times in column A
 
Upvote 0
Can anyone help? I'm looking to dedupe column A and create a single unique record (row) for each value in column A, while populating 6 columns created by the values in Column C, with the values in column B, all while corresponding to the original IDs in column A.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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