Transposing Data from two columns with a common data identifier into another column one row at a time

Cyphas

New Member
Joined
Oct 23, 2021
Messages
12
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hi Guys, I am wondering if there is a way to transpose data that are in two columns B & C,ie (Attribute and Value) relating to a unique reference id, that is in column A (Product Code) with B & C grouped together separated by a colon : and each Attribute: Value combination is separated with a semi-colon ; and then having the reference id on the same row but different column.

The number of Attributes to Value combinations is different per reference ID so it needs to know when it gets to the end to switch to a new row.

Here is an example of how I want it to be:

OTWholesaleContent_Attributes_26-02-2021.xlsx
ABCDEFG
1Product CodeAttributeValueProduct CodeSpec
2000574TypeBallpoint & Rollerball Pens000574Type: Ballpoint & Rollerball Pens;Manu: Newell Rubbermaid;Brand: Paper Mate
3000574ManuNewell Rubbermaid000999Brand: Bic;Colour: Blue;Form: Ballpoint Pen;
4000574BrandPaper Mate104Tip Size: Fine Point;Line Width: 0.4mm Line
5000999BrandBicXD123Ink Type:Oil-based Ink;Type: Printer;Colour: Blue
6000999ColourBlue
7000999FormBallpoint Pens
8104Tip SizeFine Point
9104Line Width0.4mm Line
10XD123Ink TypeOil-based Ink
11XD123TypePrinter
12XD123ColourBlue
Sheet3


Here is an Example of the Actual Data in minisheet

OTWholesaleContent_Attributes_26-02-2021.xlsx
ABC
1Product codeAttributeValue
2000574TypeBallpoint & Rollerball Pens
3000574ManufacturerNewell Rubbermaid
4000574BrandPaper Mate
5000574ColourBlue
6000574FormBallpoint Pens
7000574Tip SizeFine Point
8000574Line Width0.4mm Line
9000574Ink TypeOil-based Ink
10000574Retractable TipYes
11000574Barrel ColourBlue
12000574Barrel FeatureRubberised Barrel with Gripping Rings
13000574Ink ColourBlue
14000574On PromotionNo
15000574ContentsPack of 12 pens
16000574Recycled Percentage36%
17000574RecyclableNo
18000582TypeBallpoint & Rollerball Pens
19000582ManufacturerNewell Rubbermaid
20000582BrandPaper Mate
21000582ColourBlack
22000582FormBallpoint Pens
23000582Tip SizeFine Point
24000582Line Width0.4mm Line
25000582Ink TypeOil-based Ink
26000582Retractable TipYes
27000582Barrel ColourBlack
28000582Barrel FeatureRubberised Barrel with Gripping Rings
29000582Ink ColourBlack
30000582On PromotionNo
31000582ContentsPack of 12 pens
32000582Recycled Percentage36%
33000582RecyclableNo
34000833TypeDrawing Aids
35000833ManufacturerMaped Group
36000833BrandHelix
37000833ColourBlack
38000833FormMaths Set
39000833MaterialVarious
40000833AngleAdjustable
41000833Stencil Size10mm
42000833On PromotionNo
43000892TypePrinted File Dividers
44000892ManufacturerPukka Pads Ltd
45000892BrandConcord
46000892ColourWhite
47000892SizeA4
48000892MaterialCard
49000892Parts Per Set54 Part
50000892Printed1 to 54
51000892Holes4-Holes
52000892TabsMylar Reinforced
53000892Grammage/Thickness150gsm
54000892OrientationPortrait
55000892WidthStandard
56000892Contents PageYes
57000892Reinforced HolesYes
58000892PrintableNo
59000892On PromotionNo
60000892Dimensions210x297mm
61000892Punched/UnpunchedPunched
62000892FSCÆ CertifiedYes
63000892Paper by NatureNo
64000892NAPM AccreditedNo
65000906TypePrinted File Dividers
66000906ManufacturerPukka Pads Ltd
67000906BrandConcord
68000906ColourWhite
69000906SizeA5
70000906MaterialCard
71000906Parts Per Set5 Part
72000906Printed1 to 5
73000906Holes2-Holes
74000906TabsMylar Reinforced
75000906Grammage/Thickness150gsm
76000906OrientationPortrait
77000906WidthStandard
78000906Contents PageYes
79000906Reinforced HolesYes
80000906PrintableNo
81000906On PromotionNo
82000906Dimensions210x148mm
83000906Punched/UnpunchedPunched
84000906FSCÆ CertifiedYes
85000906Paper by NatureNo
86000906NAPM AccreditedNo
87000922TypePrinted File Dividers
88000922ManufacturerPukka Pads Ltd
89000922BrandConcord
90000922ColourWhite
91000922SizeA4
92000922MaterialCard
93000922Parts Per Set5 Part
94000922Printed1 to 5
95000922HolesMulti-Punched
96000922TabsWhite Tabs
97000922Grammage/Thickness160gsm
98000922OrientationPortrait
99000922WidthStandard
100000922Contents PageYes
101000922Reinforced HolesYes
102000922PrintableNo
103000922On PromotionNo
104000922Dimensions210x297mm
105000922Punched/UnpunchedPunched
106000922Paper by NatureNo
107000922NAPM AccreditedNo
108000930TypePrinted File Dividers
109000930ManufacturerPukka Pads Ltd
110000930BrandConcord
111000930ColourWhite
112000930SizeA4
113000930MaterialCard
114000930Parts Per Set10 Part
115000930Printed1 to 10
116000930HolesMulti-Punched
117000930TabsWhite Tabs
118000930Grammage/Thickness160gsm
119000930OrientationPortrait
120000930WidthStandard
121000930Contents PageYes
122000930Reinforced HolesYes
123000930PrintableNo
124000930On PromotionNo
125000930Dimensions210x297mm
126000930Punched/UnpunchedPunched
127000930Paper by NatureNo
128000930NAPM AccreditedNo
129000949TypePrinted File Dividers
130000949ManufacturerPukka Pads Ltd
131000949BrandConcord
132000949ColourWhite
133000949SizeA4
134000949MaterialCard
135000949Parts Per Set12 Part
136000949Printed1 to 12
137000949HolesMulti-Punched
138000949TabsWhite Tabs
139000949Grammage/Thickness160gsm
140000949OrientationPortrait
141000949WidthStandard
142000949Contents PageYes
143000949Reinforced HolesYes
144000949PrintableNo
145000949On PromotionNo
146000949Dimensions210x297mm
147000949Punched/UnpunchedPunched
148000949Paper by NatureNo
149000949NAPM AccreditedNo
150000957TypePrinted File Dividers
OTWholesaleContent_Attributes_2


Thank you in advance for your assistance.
Cyphas
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
VBA Code:
Option Explicit
Sub test()
Dim lr&, dic As Object, cell As Range, Spect As String
Set dic = CreateObject("Scripting.Dictionary")
lr = Cells(Rows.Count, "A").End(xlUp).Row
    For Each cell In Range("A2:A" & lr)
        Spect = cell.Offset(0, 1) & ":" & cell.Offset(0, 2)
        If Not dic.exists(cell.Value) And cell.Value <> "" Then
            dic.Add cell.Value, Spect
        Else: dic(cell.Value) = dic(cell.Value) & ";" & Spect
        End If
    Next
    Range("F2:G100000").ClearContents
    Range("F2").Resize(dic.Count).Value = WorksheetFunction.Transpose(dic.keys)
    For lr = 1 To dic.Count
        Range("G" & lr + 1).Value = dic.items()(lr - 1)
    Next
End Sub
 
Upvote 0
A formula option
+Fluff 1.xlsm
ABCDEFG
1Product codeAttributeValue
2574TypeBallpoint & Rollerball Pens574Type: Ballpoint & Rollerball Pens; Manufacturer: Newell Rubbermaid; Brand: Paper Mate; Colour: Blue; Form: Ballpoint Pens; Tip Size: Fine Point; Line Width: 0.4mm Line; Ink Type: Oil-based Ink; Retractable Tip: Yes; Barrel Colour: Blue; Barrel Feature: Rubberised Barrel with Gripping Rings; Ink Colour: Blue; On Promotion: No; Contents: Pack of 12 pens; Recycled Percentage: 0.36; Recyclable: No
3574ManufacturerNewell Rubbermaid582Type: Ballpoint & Rollerball Pens; Manufacturer: Newell Rubbermaid; Brand: Paper Mate; Colour: Black; Form: Ballpoint Pens; Tip Size: Fine Point; Line Width: 0.4mm Line; Ink Type: Oil-based Ink; Retractable Tip: Yes; Barrel Colour: Black; Barrel Feature: Rubberised Barrel with Gripping Rings; Ink Colour: Black; On Promotion: No; Contents: Pack of 12 pens; Recycled Percentage: 0.36; Recyclable: No
4574BrandPaper Mate833Type: Drawing Aids; Manufacturer: Maped Group; Brand: Helix; Colour: Black; Form: Maths Set; Material: Various; Angle: Adjustable; Stencil Size: 10mm; On Promotion: No
5574ColourBlue892Type: Printed File Dividers; Manufacturer: Pukka Pads Ltd; Brand: Concord; Colour: White; Size: A4; Material: Card; Parts Per Set: 54 Part; Printed: 1 to 54; Holes: 4-Holes; Tabs: Mylar Reinforced; Grammage/Thickness: 150gsm; Orientation: Portrait; Width: Standard; Contents Page: Yes; Reinforced Holes: Yes; Printable: No; On Promotion: No; Dimensions: 210x297mm; Punched/Unpunched: Punched; FSCÆ Certified: Yes; Paper by Nature: No; NAPM Accredited: No
6574FormBallpoint Pens906Type: Printed File Dividers; Manufacturer: Pukka Pads Ltd; Brand: Concord; Colour: White; Size: A5; Material: Card; Parts Per Set: 5 Part; Printed: 1 to 5; Holes: 2-Holes; Tabs: Mylar Reinforced; Grammage/Thickness: 150gsm; Orientation: Portrait; Width: Standard; Contents Page: Yes; Reinforced Holes: Yes; Printable: No; On Promotion: No; Dimensions: 210x148mm; Punched/Unpunched: Punched; FSCÆ Certified: Yes; Paper by Nature: No; NAPM Accredited: No
7574Tip SizeFine Point922Type: Printed File Dividers; Manufacturer: Pukka Pads Ltd; Brand: Concord; Colour: White; Size: A4; Material: Card; Parts Per Set: 5 Part; Printed: 1 to 5; Holes: Multi-Punched; Tabs: White Tabs; Grammage/Thickness: 160gsm; Orientation: Portrait; Width: Standard; Contents Page: Yes; Reinforced Holes: Yes; Printable: No; On Promotion: No; Dimensions: 210x297mm; Punched/Unpunched: Punched; Paper by Nature: No; NAPM Accredited: No
8574Line Width0.4mm Line930Type: Printed File Dividers; Manufacturer: Pukka Pads Ltd; Brand: Concord; Colour: White; Size: A4; Material: Card; Parts Per Set: 10 Part; Printed: 1 to 10; Holes: Multi-Punched; Tabs: White Tabs; Grammage/Thickness: 160gsm; Orientation: Portrait; Width: Standard; Contents Page: Yes; Reinforced Holes: Yes; Printable: No; On Promotion: No; Dimensions: 210x297mm; Punched/Unpunched: Punched; Paper by Nature: No; NAPM Accredited: No
9574Ink TypeOil-based Ink949Type: Printed File Dividers; Manufacturer: Pukka Pads Ltd; Brand: Concord; Colour: White; Size: A4; Material: Card; Parts Per Set: 12 Part; Printed: 1 to 12; Holes: Multi-Punched; Tabs: White Tabs; Grammage/Thickness: 160gsm; Orientation: Portrait; Width: Standard; Contents Page: Yes; Reinforced Holes: Yes; Printable: No; On Promotion: No; Dimensions: 210x297mm; Punched/Unpunched: Punched; Paper by Nature: No; NAPM Accredited: No
10574Retractable TipYes957Type: Printed File Dividers
11574Barrel ColourBlue
12574Barrel FeatureRubberised Barrel with Gripping Rings
13574Ink ColourBlue
14574On PromotionNo
15574ContentsPack of 12 pens
16574Recycled Percentage0.36
17574RecyclableNo
18582TypeBallpoint & Rollerball Pens
19582ManufacturerNewell Rubbermaid
20582BrandPaper Mate
21582ColourBlack
22582FormBallpoint Pens
23582Tip SizeFine Point
24582Line Width0.4mm Line
25582Ink TypeOil-based Ink
26582Retractable TipYes
27582Barrel ColourBlack
28582Barrel FeatureRubberised Barrel with Gripping Rings
29582Ink ColourBlack
30582On PromotionNo
31582ContentsPack of 12 pens
32582Recycled Percentage0.36
33582RecyclableNo
34833TypeDrawing Aids
35833ManufacturerMaped Group
36833BrandHelix
37833ColourBlack
38833FormMaths Set
39833MaterialVarious
40833AngleAdjustable
41833Stencil Size10mm
42833On PromotionNo
43892TypePrinted File Dividers
44892ManufacturerPukka Pads Ltd
45892BrandConcord
46892ColourWhite
47892SizeA4
48892MaterialCard
49892Parts Per Set54 Part
50892Printed1 to 54
51892Holes4-Holes
52892TabsMylar Reinforced
53892Grammage/Thickness150gsm
54892OrientationPortrait
55892WidthStandard
56892Contents PageYes
57892Reinforced HolesYes
58892PrintableNo
59892On PromotionNo
60892Dimensions210x297mm
61892Punched/UnpunchedPunched
62892FSCÆ CertifiedYes
63892Paper by NatureNo
64892NAPM AccreditedNo
65906TypePrinted File Dividers
66906ManufacturerPukka Pads Ltd
67906BrandConcord
68906ColourWhite
69906SizeA5
70906MaterialCard
71906Parts Per Set5 Part
72906Printed1 to 5
73906Holes2-Holes
74906TabsMylar Reinforced
75906Grammage/Thickness150gsm
76906OrientationPortrait
77906WidthStandard
78906Contents PageYes
79906Reinforced HolesYes
80906PrintableNo
81906On PromotionNo
82906Dimensions210x148mm
83906Punched/UnpunchedPunched
84906FSCÆ CertifiedYes
85906Paper by NatureNo
86906NAPM AccreditedNo
87922TypePrinted File Dividers
88922ManufacturerPukka Pads Ltd
89922BrandConcord
90922ColourWhite
91922SizeA4
92922MaterialCard
93922Parts Per Set5 Part
94922Printed1 to 5
95922HolesMulti-Punched
96922TabsWhite Tabs
97922Grammage/Thickness160gsm
98922OrientationPortrait
99922WidthStandard
100922Contents PageYes
101922Reinforced HolesYes
102922PrintableNo
103922On PromotionNo
104922Dimensions210x297mm
105922Punched/UnpunchedPunched
106922Paper by NatureNo
107922NAPM AccreditedNo
108930TypePrinted File Dividers
109930ManufacturerPukka Pads Ltd
110930BrandConcord
111930ColourWhite
112930SizeA4
113930MaterialCard
114930Parts Per Set10 Part
115930Printed1 to 10
116930HolesMulti-Punched
117930TabsWhite Tabs
118930Grammage/Thickness160gsm
119930OrientationPortrait
120930WidthStandard
121930Contents PageYes
122930Reinforced HolesYes
123930PrintableNo
124930On PromotionNo
125930Dimensions210x297mm
126930Punched/UnpunchedPunched
127930Paper by NatureNo
128930NAPM AccreditedNo
129949TypePrinted File Dividers
130949ManufacturerPukka Pads Ltd
131949BrandConcord
132949ColourWhite
133949SizeA4
134949MaterialCard
135949Parts Per Set12 Part
136949Printed1 to 12
137949HolesMulti-Punched
138949TabsWhite Tabs
139949Grammage/Thickness160gsm
140949OrientationPortrait
141949WidthStandard
142949Contents PageYes
143949Reinforced HolesYes
144949PrintableNo
145949On PromotionNo
146949Dimensions210x297mm
147949Punched/UnpunchedPunched
148949Paper by NatureNo
149949NAPM AccreditedNo
150957TypePrinted File Dividers
Lists
Cell Formulas
RangeFormula
F2:F10F2=UNIQUE(A2:A150)
G2:G10G2=TEXTJOIN({": ","; "},,FILTER($B$2:$C$150,$A$2:$A$150=F2))
Dynamic array formulas.
 
Upvote 0
Thank you @bebo021999 & @Fluff. I'll have a go and both and come back to you. It's easy to see your formula works Fluff from the built-in sheet. I'll test the VBA code and see which is faster/easier. If both work easily, how does one award split a solution?

Best regards
Cyphas
 
Upvote 0
If both work easily, how does one award split a solution?
You can't only one post can be marked as the solution, so just mark the one you choose to use. :)
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,195
Members
449,072
Latest member
DW Draft

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