Transpose in Excel by Rules

@Atakan_Kiziltan
As an variation to @Lahiru.Fernando with the same Idea of segementation

Assumption:

  • each segement has a length of 5 values and is complete

otherwise we have to handle additional

First step preperations
Prepare the dataTable for the transposed data:
grafik

Second step: bring all values into a list and filter out empty values:

Assign Activity:
dtData.AsEnumerable.Select(function ( r ) r(0).toString).Where(Function (s) Not String.IsNullOrWhiteSpace(s)).toList

Third Step: Transpose Values:
Assign Activity:
(From segment In Enumerable.Range(0,(Values.Count \ 5))
Select d=Values.Skip(segment*5).Take(5).ToArray
Select dtTransposed.Rows.Add(d)).CopyToDataTable

And assign it to dtTransposed that was prepared from above

dtTransposed can later be used for a write range to Excel

PFA Demo XAML here:
Atakan Kızıltan.xaml (9.8 KB)

2 Likes