Repeat Values Like Desired Output Column

ExcelToDAX

Board Regular
Joined
Feb 9, 2023
Messages
203
Office Version
  1. 365
Platform
  1. Windows
How can I repeat the columns like in Column A Desired Output? I want it to repeat like the following screenshot below:

1719937203018.png


Current
NAME1
Column1
Test2
Row3
Cell4
NAME2
Column1
Test2
Row3
Cell4
NAME3
Column1
Test2
Row3
Cell4
NAME4
Column1
Test2
Row3
Cell4
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I am not quite clear.
Between columns A and B, which one is the column you are STARTING with, and which column is what you want as your expected output?
And does the pattern ALWAYS repeat after 5 rows, like shown in your example?
 
Upvote 0
If it does not repeat every 5 rows, how can you tell which rows to repeat?
 
Upvote 0
One option:
Book1
AB
1
2NAME1NAME1
3NAME1Column1
4NAME1Test2
5NAME1Row3
6NAME1Cell4
7NAME2NAME2
8NAME2Column1
9NAME2Test2
10NAME2Row3
11NAME2Cell4
12NAME3NAME3
13NAME3Column1
14NAME3Test2
15NAME3Row3
16NAME3Cell4
17NAME4NAME4
18NAME4Column1
19NAME4Test2
20NAME4Row3
21NAME4Cell4
Sheet1
Cell Formulas
RangeFormula
A2:A21A2=INDEX(B2:B21,5*ROUNDUP(SEQUENCE(ROWS(B2:B21))/5,0)-4)
Dynamic array formulas.
 
Upvote 1
Solution
Given your handle and history, any reason you are not using Power Query to do it ?

1719967341753.png


No manual M code changes made in the below.
I did use the Heading "Current" in the original data source which may not suit.

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Added Index" = Table.AddIndexColumn(Source, "Index", 0, 1, Int64.Type),
    #"Inserted Modulo" = Table.AddColumn(#"Added Index", "Modulo", each Number.Mod([Index], 5), type number),
    #"Added Conditional Column" = Table.AddColumn(#"Inserted Modulo", "Name", each if [Modulo] = 0 then [Current] else null),
    #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Name"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Filled Down",{"Name", "Current", "Index", "Modulo"}),
    #"Removed Other Columns" = Table.SelectColumns(#"Reordered Columns",{"Name", "Current"})
in
    #"Removed Other Columns"
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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