Clean up SQL import, record with multiple values in one column

Pcuezze

New Member
Joined
Oct 5, 2018
Messages
5
I imported some data from a SQL database. However, one field has multiple values. Each record is a row but in the field with multiple values, a 2nd row was created with only that value (column K). I would like to move data from K to the corresponding row above it in Column L, M, or N as needed. Although this picture shows each record containing exactly 4 Column K values, some have less. Normally, I'm pretty good at googling problems like this, but I couldn't figure out how to word my question correctly so thanks in advance! Patrick

problem
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Ok. Feeling dumb today. (sorry for the multiple posts, I'm to new to edit or delete my posts)

problem.png
 
Upvote 0
much better is a link to the excel file than picture :)
is that what you want?

Column1Column2Column3Column4Column5Column6Column7Column8Column9Column10Custom.1Custom.2Custom.3Custom.4
0​
jmonger
1004​
07/01/2018​
47​
LAKEVIEWLTBobSmithFemale8/23/33G20I10N39.498E78.5
0​
stownsley
1003​
07/01/2018​
45​
NottinghamBobSmithMale9/25/52C34.90J15.9K21.9G89.29
0​
stownsley
1003​
07/01/2018​
44​
NottinghamBoSmithMale4/1/32R41.82N39.0N18.9M62.81
0​
stownsley
1003​
07/01/2018​
45​
NottinghamBobSmithMale5/19/46I42.9I25.1F06.4J44.1
0​
stownsley
1003​
07/01/2018​
44​
NottinghamBobSmithFemale8/30/38K59.00M13.0M54.5Ell.8
0​
stownsley
1003​
07/01/2018​
45​
NottinghamBobSmithFemale2/26/45I25.1K21.9K59.00M62.81
0​
stownsley
1003​
07/01/2018​
44​
NottinghamBobSmithFemale11/21/46K59.00S72.001AN18.6R41.82
0​
stownsley
1003​
07/01/2018​
44​
NottinghamBobSmithMale5/10/35R11.0K21.9M10.00D64.9
0​
stownsley
1003​
07/01/2018​
45​
NottinghamBobSmithMale12/25/39M84.452A
 
Upvote 0
take the data from sql db into PowerQuery (aka Get&Transform)

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", type text}, {"Column3", Int64.Type}, {"Column4", type date}, {"Column5", Int64.Type}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}, {"Column11", type text}}),
    #"Filled Down" = Table.FillDown(#"Changed Type",{"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10"}),
    #"Grouped Rows" = Table.Group(#"Filled Down", {"Column1", "Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10"}, {{"Count", each _, type table}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([Count],"Column11")),
    #"Extracted Values" = Table.TransformColumns(#"Added Custom", {"Custom", each Text.Combine(List.Transform(_, Text.From), ","), type text}),
    #"Removed Columns" = Table.RemoveColumns(#"Extracted Values",{"Count"}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Custom", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Custom.1", "Custom.2", "Custom.3", "Custom.4"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Custom.1", type text}, {"Custom.2", type text}, {"Custom.3", type text}, {"Custom.4", type text}})
in
    #"Changed Type1"[/SIZE]
 
Upvote 0

Forum statistics

Threads
1,215,510
Messages
6,125,237
Members
449,217
Latest member
Trystel

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