Promoting one column to become headers whilst keeping data paired

Milos

Board Regular
Joined
Aug 28, 2016
Messages
121
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Hi there,

Would anybody know how I best attempt this transposing task? VBA or power query?. I need to promote column B to become headers, but the data in column A and C are paired with one another.

Data in raw format:
Column A
Column B
Column C
TypeCategoryResult
ABCAddress49 Joe Blogs Street
ABCPhone Number027JOEBLOGS
ABCEmailjoe.bloggs@gmail.com
BCDAddress83 Jenny Blogs Street
BCDPhone Number027JENNYBlOGS
BCDPlanned Trip1 March 2020
CDEAddress15 No Idea Lane
CDEPhone Number021NOIDEA

Data in required format:
Column A
Column B
Column C
Column D
Column E
TypeAddressPhone NumberEmailPlanned Trip
ABC49 Joe Blogs Street027JOEBLOGSjoe.bloggs@gmail.com
BCD83 Jenny Blogs Street027JENNYBlOGS
CDE15 No Idea Lane021NOIDEA1 March 2020

Any help with putting me in the right direction is greatly appreciated!

Cheers,
Milos
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Milos

In Power Query you could delete the 'header' row and then pivot on column B.

When pivoting choose column C for values and select Don't aggregrate for the Aggregrate Value Function under Advanced options.
VBA Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column A", type text}, {"Column B", type text}, {"Column C", type any}}),
    #"Removed Top Rows" = Table.Skip(#"Changed Type",1),
    #"Pivoted Column" = Table.Pivot(#"Removed Top Rows", List.Distinct(#"Removed Top Rows"[#"Column B"]), "Column B", "Column C")
in
    #"Pivoted Column"
 
Upvote 0
You are a champion thanks Norie. I was playing around in Power Query but the 'Don't aggregate' section was where I stumbled! Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
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