Forum Discussion
Alex_Barbosa99
Apr 30, 2023Copper Contributor
How to divide cell value in many lines?
Hello, I would like to create a macro to divide cell value in many lines as the following: Input: A 360 B 120 C 240 D 480 E 60 Output: A 120 A 120 A 1...
SergeiBaklan
May 01, 2023Diamond Contributor
OliverScheurich , thanks for the idea. Tried to repeat without UI
let
Source = Excel.CurrentWorkbook(),
input = Source{[Name="Input"]}[Content],
divisor = Source{[Name="divisor"]}[Content],
getRepeats = List.Zip(
{
input[Column1],
List.Transform(
input[Column2],
(q) => Number.Round( Number.IntegerDivide(q, divisor[Column1]{0} ) ) )
} ),
repeatIt = Table.FromList(
List.Combine(
List.Transform( getRepeats, (q) => List.Repeat( {q{0}},
List.Max( {1, q{1} } ) ) )
),
null,
{"Output"}
)
in
repeatIt
on