Redesign excel format

MiniFav

Board Regular
Joined
Mar 10, 2020
Messages
83
Office Version
  1. 365
Platform
  1. Windows
I have the following spreadsheet with about 2000 rows,

Book1
ABCDEFGHIJKLMNO
1Ref No(s)TitleEff DateATAComments
2TEST 1B737 ADVERTISING PLACARD INSTALLATION25Referenced By: TEST
3ParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
4Initial Issue, InstallationB737 ADVERTISING PLACARD INSTALLATIONTESTNDate Days (Calendar) Hours Landings Works Order28Aug2013 5287 36714:16 25270 055072FirstCompleted
5Initial Issue, RemovalB737 ADVERTISING PLACARD REMOVALTESTNDate Days (Calendar) Hours Landings Works Order02Nov2013 5352 37283:01 25591 057123FirstCompleted
6Ref No(s)TitleEff DateATAComments
7TEST 2Portable Equipment Device Fire Kit (PEDFK) installation in Cabin Compartment25-20References: TEST
8ParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
9Initial IssueParagraph Not DefinedTESTNDate Days (Calendar) Hours Landings Works Order27Oct2018 7173 49948:51 33402 11002831Oct2018FirstCompleted
10Ref No(s)TitleEff DateATAComments
11TEST 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATA
12ParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
13Issue 1Micro QAR InstallationTESTNDate Days (Calendar) Hours Landings25Oct2004 2058 12569:00 10497FirstCompleted
14Issue 2Micro QAR InstallationN/A - Other reason Issue 1 was performed
15Issue 3Micro QAR InstallationN/A - Other reason Issue 1 was performed
16Issue 4Micro QAR InstallationN/A - Other reason Issue 1 was performed
17Issue 5Micro QAR InstallationN/A - Other reason Issue 1 was performed
18Issue 6Micro QAR InstallationN/A - Other reason Issue 1 was performed
19Issue 7Micro QAR InstallationN/A - Other reason Issue 1 was performed
20Issue 8, InstallationMicro QAR InstallationN/A - Other reason Issue 1 was performed
21Issue 8, RemovalMicro QAR RemovalTESTNDate Days (Calendar) Hours LandingsFirst
Sheet1


And would like to make it one line per item like this,

Book1
ABCDEFGHIJKLMNOPQRS
1REF No(s)TitleEff DateATACommentsParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
2TEST 1B737 ADVERTISING PLACARD INSTALLATION25Referenced By: TESTInitial Issue, InstallationB737 ADVERTISING PLACARD INSTALLATIONTESTNDate Days (Calendar) Hours Landings Works Order28Aug2013 5287 36714:16 25270 055072FirstCompleted
3TEST 1B737 ADVERTISING PLACARD INSTALLATION25Referenced By: TESTInitial Issue, RemovalB737 ADVERTISING PLACARD REMOVALTESTNDate Days (Calendar) Hours Landings Works Order02Nov2013 5352 37283:01 25591 057123FirstCompleted
4REF No(s)TitleEff DateATACommentsParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
5Test 2Portable Equipment Device Fire Kit (PEDFK) installation in Cabin Compartment25-20References: TESTInitial IssueParagraph Not DefinedTESTNDate Days (Calendar) Hours Landings Works Order27Oct2018 7173 49948:51 33402 11002831Oct2018FirstCompleted
6REF No(s)TitleEff DateATACommentsParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
7Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 1Micro QAR InstallationTESTNDate Days (Calendar) Hours Landings25Oct2004 2058 12569:00 10497FirstCompleted
8Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 2Micro QAR InstallationN/A - Other reason Issue 1 was performed
9Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 3Micro QAR InstallationN/A - Other reason Issue 1 was performed
10Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 4Micro QAR InstallationN/A - Other reason Issue 1 was performed
11Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 5Micro QAR InstallationN/A - Other reason Issue 1 was performed
12Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 6Micro QAR InstallationN/A - Other reason Issue 1 was performed
13Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 7Micro QAR InstallationN/A - Other reason Issue 1 was performed
14Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 8, InstallationMicro QAR InstallationN/A - Other reason Issue 1 was performed
15Test 3Introduction of TEST DATA04Aug200431Referenced By: TEST DATAIssue 8, RemovalMicro QAR RemovalTESTNDate Days (Calendar) Hours LandingsFirst
Sheet1


Does anyone know a quick way to do this?
 

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.
I would suggest Power Query to unpivot your table.
 
Upvote 0
Something like this script in Power Query produces an output very close to your example. You may want to revise the table structure to avoid the extended/merged cells (e.g., columns K:S) in some of the groups. This example assumes your starting table is "Table1"
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Replaced Value" = Table.ReplaceValue(Source,null,"",Replacer.ReplaceValue,{"Column1", "Column2"}),
    #"Added Index" = Table.AddIndexColumn(#"Replaced Value", "Index", 1, 1, Int64.Type),
    #"Added Conditional Column" = Table.AddColumn(#"Added Index", "IdxUpperBlock", each if Text.Contains([Column1], "Ref No") then [Index] else null),
    #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"IdxUpperBlock"}),
    #"Added Conditional Column1" = Table.AddColumn(#"Filled Down", "IdxLowerBlock", each if Text.Contains([Column2], "Paragraph") then [IdxUpperBlock] else null),
    #"Filled Down1" = Table.FillDown(#"Added Conditional Column1",{"IdxLowerBlock"}),
    StagedTable = Table.AddColumn(#"Filled Down1", "DeleteRow", each if [IdxUpperBlock] = [IdxLowerBlock] then "delete" else null),
    #"Filtered Rows" = Table.SelectRows(StagedTable, each ([DeleteRow] = null)),
    #"Added Conditional Column2" = Table.AddColumn(#"Filtered Rows", "UpperHds", each if Text.Contains([Column1], "Ref No") then 0 else [IdxUpperBlock]),
    Upper = Table.SelectColumns(#"Added Conditional Column2",{"Column1", "Column4", "Column8", "Column10", "Column11", "UpperHds"}),
    BeginPreppingLower = Table.SelectRows(StagedTable, each ([DeleteRow] = "delete")),
    #"Removed Columns2" = Table.RemoveColumns(BeginPreppingLower,{"Column1"}),
    #"Added Conditional Column3" = Table.AddColumn(#"Removed Columns2", "IdLowerHds", each if [Column2] = "Paragraph" then 0 else [IdxUpperBlock]),
    Lower = Table.Group(#"Added Conditional Column3", {"IdLowerHds"}, {{"LowerGroups", each _, type table [Column2=text, Column3=nullable text, Column4=any, Column5=nullable text, Column6=nullable text, Column7=text, Column8=any, Column9=nullable text, Column10=any, Column11=nullable text, Column12=any, Column13=nullable text, Column14=nullable text, Column15=nullable text, Index=number, IdxUpperBlock=number, IdxLowerBlock=number, DeleteRow=text, IdLowerHds=number]}}),
    #"Merged Queries" = Table.NestedJoin(Upper, {"UpperHds"}, Lower, {"IdLowerHds"}, "Lower", JoinKind.LeftOuter),
    #"Expanded Lower" = Table.ExpandTableColumn(#"Merged Queries", "Lower", {"IdLowerHds", "LowerGroups"}, {"IdLowerHds", "LowerGroups"}),
    #"Expanded LowerGroups" = Table.ExpandTableColumn(#"Expanded Lower", "LowerGroups", {"Column2", "Column3", "Column4", "Column5", "Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12", "Column13", "Column14", "Column15", "Index", "IdxUpperBlock", "IdxLowerBlock", "DeleteRow", "IdLowerHds"}, {"Column2", "Column3", "Column4.1", "Column5", "Column6", "Column7", "Column8.1", "Column9", "Column10.1", "Column11.1", "Column12", "Column13", "Column14", "Column15", "Index", "IdxUpperBlock", "IdxLowerBlock", "DeleteRow", "IdLowerHds.1"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Expanded LowerGroups",{"Column1", "Column4", "Column8", "Column10", "Column11", "Column2", "Column3", "Column4.1", "Column5", "Column6", "Column7", "Column8.1", "Column9", "Column10.1", "Column11.1", "Column12", "Column13", "Column14", "Column15", "Index", "IdxUpperBlock", "IdxLowerBlock", "DeleteRow", "IdLowerHds.1", "UpperHds", "IdLowerHds"}),
    #"Removed Duplicates" = Table.Distinct(#"Reordered Columns", {"Index"}),
    #"Sorted Rows" = Table.Sort(#"Removed Duplicates",{{"Index", Order.Ascending}}),
    #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Index", "IdxUpperBlock", "IdxLowerBlock", "DeleteRow", "IdLowerHds.1", "UpperHds", "IdLowerHds"})
in
    #"Removed Columns"

Column2Column3Column4.1Column5Column6Column7Column8.1Column9Column10.1Column11.1Column12Column13Column14Column15
ParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
Initial Issue, InstallationB737 ADVERTISING PLACARD INSTALLATIONTESTNDate Days (Calendar) Hours Landings Works Order28Aug2013 5287 36714:16 25270 055072FirstCompleted
Initial Issue, RemovalB737 ADVERTISING PLACARD REMOVALTESTNDate Days (Calendar) Hours Landings Works Order02Nov2013 5352 37283:01 25591 057123FirstCompleted
ParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
Initial IssueParagraph Not DefinedTESTNDate Days (Calendar) Hours Landings Works Order27Oct2018 7173 49948:51 33402 11002843404FirstCompleted
ParagraphMethod Of ComplianceRLifeLast ComplE/D O/RideLimit/ IntervalF/ LNext DueRemain
Issue 1Micro QAR InstallationTESTNDate Days (Calendar) Hours Landings25Oct2004 2058 12569:00 10497FirstCompleted
Issue 2Micro QAR InstallationN/A - Other reason Issue 1 was performed
Issue 3Micro QAR InstallationN/A - Other reason Issue 1 was performed
Issue 4Micro QAR InstallationN/A - Other reason Issue 1 was performed
Issue 5Micro QAR InstallationN/A - Other reason Issue 1 was performed
Issue 6Micro QAR InstallationN/A - Other reason Issue 1 was performed
Issue 7Micro QAR InstallationN/A - Other reason Issue 1 was performed
Issue 8, InstallationMicro QAR InstallationN/A - Other reason Issue 1 was performed
Issue 8, RemovalMicro QAR RemovalTESTNDate Days (Calendar) Hours LandingsFirst

A sample of the workbook is available here...the starting point is Table1 on Sheet1 and the output table from Power Query is loaded onto the Table1 worksheet (when executed with Data > Refresh All):
 
Upvote 0
Solution
That is fantastic, All of what you have used is new to me but very simple to use with your instruction.
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,961
Members
452,539
Latest member
delvey

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