top of page

Excel Arena

This is the place, where we can test the boundaries of Excel functions.

Numerous Methods to Accomplish a Task - Excel, Power Query and Python

Task:

Generate the result table as shown.



Solution:

Excel:

=MAP(A2:D4,LAMBDA(x,CONCAT(TAKE(x:D4,1))))


=LET(a,A2:D4,b,COLUMNS(a),LEFT(BYROW(a,CONCAT),SEQUENCE(,b,b,-1)))


Power Query:

let

 Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],

 Result = Table.FromRows(List.Split(List.TransformMany(Table.ToRows(Source), each List.Reverse(List.Positions(_)), (x,y) => Text.Combine(List.FirstN(x,y + 1))), Table.ColumnCount(Source)))

in

 Result


Python in Excel:

df = xl("A2:D4")

fin = df.astype(str).apply(lambda x: [''.join(x[i:]) for i in range(len(x))], axis = 1, result_type = "expand")

fin

Comments


  • LinkedIn
  • Facebook
  • Twitter
  • Instagram
bottom of page