Functions/VBA for regrouping and merging data

VoidGenome

New Member
Joined
Sep 29, 2019
Messages
5
Could anyone please point me in right directions on how to do this with functions/VBA?
0000000.png


The input range is fixed (A3:B10), but the data in both columns are variables.
 
You're welcome, glad to help. :)

As a matter of interest, did you go with the formula approach, macro or power query?
I chose the VBA one although I don’t really understand the code. TEXTJOIN isn’t available on older version Excel and I figured out everything would be simpler by using VBA instead.
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I chose the VBA one although I don’t really understand the code.
OK, thanks - the two codes posted were virtually identical but if you are interested, a more compact version would be:

Code:
Sub ClassNames_v2()
  Dim d As Object
  Dim c As Range
  
  Set d = CreateObject("Scripting.Dictionary")
  For Each c In Range("A3", Range("A" & Rows.Count).End(xlUp))
    d(c.Value) = d(c.Value) & ", " & c.Offset(, 1).Value
  Next c
  Range("D3:E3").Resize(d.Count).Value = Application.Transpose(Array(d.Keys, d.Items))
  Range("E3").Resize(d.Count).TextToColumns DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 9), Array(2, 1))
End Sub
 
Upvote 0
Power Query is available on all Excel version starting with 2010. In 2016, it is called Get and Transform and is located on the Data Tab.
 
Upvote 0

Forum statistics

Threads
1,216,883
Messages
6,133,256
Members
449,792
Latest member
ArchieGB

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