Consolidating columns of text based

Roonie847

New Member
Joined
Sep 6, 2019
Messages
4
I have a data set that looks like this:

[TABLE="width: 128"]
<colgroup><col width="64" style="width:48pt" span="2"> </colgroup><tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Col1[/TD]
[TD="width: 64, bgcolor: transparent"]Col2[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]a[/TD]
[TD="bgcolor: transparent"]sam[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]b[/TD]
[TD="bgcolor: transparent"]sam[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]c[/TD]
[TD="bgcolor: transparent"]sam[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]d[/TD]
[TD="bgcolor: transparent"]sam[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]e[/TD]
[TD="bgcolor: transparent"]sam[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]f[/TD]
[TD="bgcolor: transparent"]sam[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]g[/TD]
[TD="bgcolor: transparent"]sam[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]a[/TD]
[TD="bgcolor: transparent"]bill[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]b[/TD]
[TD="bgcolor: transparent"]bill[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]d[/TD]
[TD="bgcolor: transparent"]bill[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]g[/TD]
[TD="bgcolor: transparent"]bill[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]h[/TD]
[TD="bgcolor: transparent"]bill[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]d[/TD]
[TD="bgcolor: transparent"]dave[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]e[/TD]
[TD="bgcolor: transparent"]dave[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]f[/TD]
[TD="bgcolor: transparent"]dave[/TD]
[/TR]
</tbody>[/TABLE]

and I need to convert it to look like this:
[TABLE="width: 128"]
<colgroup><col width="64" style="width:48pt" span="2"> </colgroup><tbody>[TR]
[TD="width: 64, bgcolor: transparent"]NewCol1[/TD]
[TD="width: 64, bgcolor: transparent"] NewCol2[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]a[/TD]
[TD="bgcolor: transparent"] sam|bill[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]b[/TD]
[TD="bgcolor: transparent"] sam|bill[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]c[/TD]
[TD="bgcolor: transparent"] sam[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]d[/TD]
[TD="bgcolor: transparent"] sam|bill|dave[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]e[/TD]
[TD="bgcolor: transparent"] sam|dave[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]f [/TD]
[TD="bgcolor: transparent"] sam|dave[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent"]h[/TD]
[TD="bgcolor: transparent"] bill[/TD]
[/TR]
</tbody>[/TABLE]

Basically, I need to consolidate all of the values from Col2 into a single data element where the values in col1 are repeated. Been looking at a creative Vlookup combined with a concat but cannot figure it out. My dataset is about 6000 rows.
 
@Toadstool
Your results for f, g & h look wrong, if you are using the data supplied in the op.
 
Upvote 0

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
It's unclear why your NewCol2 doesn't have an entry for g?

If I can use worker columns this does the job, but you'll need to copy N right if you've more than 6 Col2s for a Col1 and add ampersands to H.

ABCDEFGHIJKLMN
Col1Col2NewCol1NewCol2Toad New Col2Wrk1Wrk2Wrk3Wrk4Wrk5Wrk6
asamasam|billsam|billsam|bill
bsambsam|billsam|billsam|bill
csamcsamsamsam
dsamdsam|bill|davesam|bill|davesam|bill|dave
esamesam|davesam|davesam|dave
fsamfsam|davesam|davesam|dave
gsamhbillsam|billsam|bill
abillbillbill
bbill

<tbody>
[TD="align: center"]1[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: center"]Toad New Col1[/TD]

[TD="align: center"]2[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: center"]a[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: center"]b[/TD]

[TD="align: center"]4[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: center"]c[/TD]

[TD="align: center"]5[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: center"]d[/TD]

[TD="align: center"]6[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: center"]e[/TD]

[TD="align: center"]7[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: center"]f[/TD]

[TD="align: center"]8[/TD]

[TD="align: right"][/TD]

[TD="align: right"][/TD]
[TD="align: center"]g[/TD]

[TD="align: center"]9[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]h[/TD]

[TD="align: center"]10[/TD]

[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"][/TD]

</tbody>
Roonie847

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]H2[/TH]
[TD="align: left"]=I2&J2&K2&L2&M2&N2[/TD]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]I2[/TH]
[TD="align: left"]=IFERROR(INDEX($B$2:$B$16,AGGREGATE(15,6,ROW($A$2:$A$16)-1/($A$2:$A$16=$G2),COLUMNS($I$1:I$1))),"")[/TD]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]J2[/TH]
[TD="align: left"]=IFERROR("|"&INDEX($B$2:$B$16,AGGREGATE(15,6,ROW($A$2:$A$16)-1/($A$2:$A$16=$G2),COLUMNS($I$1:J$1))),"")[/TD]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]K2[/TH]
[TD="align: left"]=IFERROR("|"&INDEX($B$2:$B$16,AGGREGATE(15,6,ROW($A$2:$A$16)-1/($A$2:$A$16=$G2),COLUMNS($I$1:K$1))),"")[/TD]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]L2[/TH]
[TD="align: left"]=IFERROR("|"&INDEX($B$2:$B$16,AGGREGATE(15,6,ROW($A$2:$A$16)-1/($A$2:$A$16=$G2),COLUMNS($I$1:L$1))),"")[/TD]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]M2[/TH]
[TD="align: left"]=IFERROR("|"&INDEX($B$2:$B$16,AGGREGATE(15,6,ROW($A$2:$A$16)-1/($A$2:$A$16=$G2),COLUMNS($I$1:M$1))),"")[/TD]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]N2[/TH]
[TD="align: left"]=IFERROR("|"&INDEX($B$2:$B$16,AGGREGATE(15,6,ROW($A$2:$A$16)-1/($A$2:$A$16=$G2),COLUMNS($I$1:N$1))),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]G2[/TH]
[TD="align: left"]{=IFERROR(INDEX($A$2:$A$16, MATCH(0, COUNTIF(G$1:$G1, $A$2:$A$16), 0)), "")}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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