Formatting data to use in pivot table

omard.

New Member
Joined
Mar 15, 2006
Messages
16
Hello All,

I have this issue have been trying to solve for a while now and cant seem to find any solution. I'm hoping someone here can help me.

Here is the issues. I have data that comes to me in this format and it have a few more columns and rows.

Dept Users
Finance I cn=User0,ou=users,o=vault|cn=User1,ou=users,o=vault
Finance I Discretionary
Finance II cn=User2,ou=users,o=vault
Finance II Discretionary
Finance III cn=User3,ou=users,o=vault
Finance III Discretionary
Finance IV cn=User4,ou=users,o=vault
Finance IV Discretionary
Finance V cn=User5,ou=users,o=vault|cn=User6,ou=users,o=vault|cn=User7,ou=users,o=vault|cn=User8,ou=users,o=vault

I first do a text to column to get all the users out of one cell and that is where i get stumped.

What i need it to look is like this.

Dept Users
Finance I cn=User0,ou=users,o=vault
Finance I cn=User1,ou=users,o=vault
Finance I Discretionary
Finance II cn=User2,ou=users,o=vault
Finance II Discretionary
Finance III cn=User3,ou=users,o=vault
Finance III Discretionary
Finance IV cn=User4,ou=users,o=vault
Finance IV Discretionary
Finance V cn=User5,ou=users,o=vault
Finance V cn=User6,ou=users,o=vault
Finance V cn=User7,ou=users,o=vault
Finance V cn=User8,ou=users,o=vault

The user information gets place vertically instead of horizontally and all the information in the cells leading up to the users gets duplicated down.

Any help would be so appreciated.
 

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
A little more info might help here.

Can you say which database exported the file this way? Also what is the file extension of the file producing this format -- .csv, etc ?
 
Upvote 0
The information comes out of an Identity Management system with very poor reporting. A query is run and that output is copy and pasted in a .csv file. I really hope this helps
 
Upvote 0
with PowerQuery (Get&Transform)

Dept UsersDeptUsers
Finance I cn=User0,ou=users,o=vault|cn=User1,ou=users,o=vaultFinance Icn=User0,ou=users,o=vault
Finance I DiscretionaryFinance Icn=User1,ou=users,o=vault
Finance II cn=User2,ou=users,o=vaultFinance IDiscretionary
Finance II DiscretionaryFinance IIcn=User2,ou=users,o=vault
Finance III cn=User3,ou=users,o=vaultFinance IIDiscretionary
Finance III DiscretionaryFinance IIIcn=User3,ou=users,o=vault
Finance IV cn=User4,ou=users,o=vaultFinance IIIDiscretionary
Finance IV DiscretionaryFinance IVcn=User4,ou=users,o=vault
Finance V cn=User5,ou=users,o=vault|cn=User6,ou=users,o=vault|cn=User7,ou=users,o=vault|cn=User8,ou=users,o=vaultFinance IVDiscretionary
Finance Vcn=User5,ou=users,o=vault
Finance Vcn=User6,ou=users,o=vault
Finance Vcn=User7,ou=users,o=vault
Finance Vcn=User8,ou=users,o=vault
Code:
[SIZE=1]
let
    Source = Excel.CurrentWorkbook(){[Name="Table5"]}[Content],
    #"Split Column by Delimiter" = Table.SplitColumn(Source, "Dept Users", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), {"Dept Users.1", "Dept Users.2", "Dept Users.3"}),
    #"Split Column by Delimiter1" = Table.ExpandListColumn(Table.TransformColumns(#"Split Column by Delimiter", {{"Dept Users.3", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Dept Users.3"),
    #"Merged Columns" = Table.CombineColumns(#"Split Column by Delimiter1",{"Dept Users.1", "Dept Users.2"},Combiner.CombineTextByDelimiter(" ", QuoteStyle.None),"Dept"),
    #"Renamed Columns" = Table.RenameColumns(#"Merged Columns",{{"Dept Users.3", "Users"}})
in
    #"Renamed Columns"[/SIZE]
 
Last edited:
Upvote 0
or if there are two columns it will be much simpler:

DeptUsersDeptUsers
Finance Icn=User0,ou=users,o=vault|cn=User1,ou=users,o=vaultFinance Icn=User0,ou=users,o=vault
Finance IDiscretionaryFinance Icn=User1,ou=users,o=vault
Finance IIcn=User2,ou=users,o=vaultFinance IDiscretionary
Finance IIDiscretionaryFinance IIcn=User2,ou=users,o=vault
Finance IIIcn=User3,ou=users,o=vaultFinance IIDiscretionary
Finance IIIDiscretionaryFinance IIIcn=User3,ou=users,o=vault
Finance IVcn=User4,ou=users,o=vaultFinance IIIDiscretionary
Finance IVDiscretionaryFinance IVcn=User4,ou=users,o=vault
Finance Vcn=User5,ou=users,o=vault|cn=User6,ou=users,o=vault|cn=User7,ou=users,o=vault|cn=User8,ou=users,o=vaultFinance IVDiscretionary
Finance Vcn=User5,ou=users,o=vault
Finance Vcn=User6,ou=users,o=vault
Finance Vcn=User7,ou=users,o=vault
Finance Vcn=User8,ou=users,o=vault

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table7"]}[Content],
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Users", Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Users")
in
    #"Split Column by Delimiter"[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,214,535
Messages
6,120,090
Members
448,944
Latest member
sharmarick

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