Arrange data horizontally pivot

Caly

Board Regular
Joined
Jul 19, 2015
Messages
159
Office Version
  1. 365
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
I have two columns of data where column A has items but then column B has multiple ways the item in column A is referenced. How can I arrange the data that is now in different rows to show horizontally so I can have it in a table?

Column A. Column B
12345. Apple
12345. Pear
5678. Red
5678. Blue


So I want to transform this data to show like this:
Column A. column B. column C.
12345. Apple. Pear
5678. Red. Blue
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
If you are willing to try Power Query, then here is a solution for you.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Column1"}, {{"Data", each _, type table [Column1=nullable number, Column2=nullable text]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Data], "Index", 1, 1)),
    #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom", "Custom", {"Column2", "Index"}, {"Custom.Column2", "Custom.Index"}),
    #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"Data"}),
    #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Removed Columns", {{"Custom.Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Removed Columns", {{"Custom.Index", type text}}, "en-US")[Custom.Index]), "Custom.Index", "Custom.Column2")
in
    #"Pivoted Column"

Book2
ABCDEF
1Column1Column2Column112
212345Apple5678RedBlue
312345Pear12345ApplePear
45678Red
55678Blue
Sheet2
 
Upvote 0
Thank you. I’m not yet familiar with power query sadly. Is there a way maybe in a pivot table to do this? Or another approach
 
Upvote 0
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
Hi thank you so much. I wanted to attach a file which may be easier to see what I’m trying to have as the end resulting view.

89CF474B-B8C6-42ED-9A9D-01D96E0E30EC.jpeg
 
Upvote 0
This is the starting point
D18F8F36-6BD1-4C87-A3ED-D50356B54621.jpeg

so In column A there is information for an item that will have the content in columns B through G but the data is unique for the lines so where the data repeats, I am trying to have it all featured on one single line going across

is Power Query the way to go on this
Thank you
 
Upvote 0
Please use XL2BB to repost your data so that we don't have to try and recreate your spreadsheet. Also, show your expected results mocked up so that we clearly understand what you want.
 
Upvote 0
Thank you so much. Which button do I select from here to upload the file?
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

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