Combining multiple horizontal rows into a vertical list (macro free!)

St Jimmy

New Member
Joined
Oct 29, 2015
Messages
36
I have a helper worksheet that automatically populates horizontal lists from different criteria as seen below
ABCDEFGH
1Test1L0123L0453L0222L0051---
2Test2L0978L0444L0124----
3Test3-------
4Test4L0743------

<tbody>
</tbody>

The columns will always fill left to right, and should always be "-" or should always start with "L0"
What I want is a column that combines the rows with "L0" so it would look like:
AAAB
18
2List of Test1 - Test4
31L0123
42L0453
53L0222
64L0051
75L0978
86L0444
97L0124
108L0743

<tbody>
</tbody>


I'd use a macro, but it would require a lot of back and forth from the wksht to vba and I'd like to minimize that for speed concerns. Wrkbk is 30mb...

My code so far is:
Code:
=If($AA3>$AB1,"-",if(Left(B1,2)="L0",B1,"-"))

The code works great for single rows, but when multiple tests populate it misses the data in the rows below...
I'm not married to the code either, so if there is something fundamentally wrong or a much easier fix I'm all ears!

Thank you for your time!
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
A few steps in Power Query will do this for you.

Code:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    UnpivoteColumns = Table.UnpivotOtherColumns(Source, {"Column1"}, "Attribute", "Value"),
    RemoveBlankRows = Table.SelectRows(UnpivoteColumns, each ([Value] <> "-")),
    RemovedColumns = Table.SelectColumns(RemoveBlankRows,{"Value"}),
    AddedIndexColumn = Table.AddIndexColumn(RemovedColumns, "Index", 1, 1),
    MoveIndexColumn = Table.ReorderColumns(AddedIndexColumn,{"Index", "Value"})
in
    MoveIndexColumn

To learn how to use this code: Power Query-How to use Mcode
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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