Repeating Lines of Data N Times

Jezzzza

New Member
Joined
Jun 29, 2023
Messages
7
Office Version
  1. 365
Platform
  1. MacOS
I need to generate a list of users, each with a line for every 2025 holiday based on their work schedule. I have all the necessary data however I need to populate a lot of repeated data into a file I am bulk loading into our system.

Example, this work schedule:
View attachment 120254

But for this schedule I have this list of users:
1733867369617.png


In my load file I essentially need the holiday list repopulated for each user with the user ID in the same row, example:

1733867433140.png

This is showing for two users, but I'd rather not have to copy paste the list of holidays and then user IDs as I have 1000+ users

Any help would be very appreciated!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
The first screenshot did not load, this is the sample work schedule:
1733869506994.png


To expand on issue, I would need to A) copy the above list of days, dates, hours, etc X number of times in a list, X being the number of users assigned, then B) copy the User IDs X number of times so that each user ID is assigned to each holiday.

Thanks for any help.
 
Upvote 0
It's difficult to provide a complete answer because the screenshot of your desired output contains fields not visible in your employee table or your holiday/schedule table (Project ID, Customer ID, Booking Type ID and Project Task ID). However, the generic syntax would look something like this:

Excel Formula:
=LET(
    array1, tblEmployees,
    array2, tblHolidays,
    a, SEQUENCE(ROWS(array1)),
    b, SEQUENCE(, ROWS(array2)),
    HSTACK(
        CHOOSEROWS(array1, TOCOL(IF(b, a))),
        CHOOSEROWS(array2, TOCOL(IF(a, b)))
    )
)

Replace "tblEmployees" and "tblHolidays" with the actual ranges/arrays that you want to be repeated. You could also use CHOOSECOLS to select and/or rearrange the desired columns, if necessary. For example:

Excel Formula:
=LET(
    array1, tblEmployees[Internal id],
    array2, CHOOSECOLS(tblHolidays,5,6,7,2),
    a, SEQUENCE(ROWS(array1)),
    b, SEQUENCE(, ROWS(array2)),
    HSTACK(
        CHOOSEROWS(array1, TOCOL(IF(b, a))),
        CHOOSEROWS(array2, TOCOL(IF(a, b)))
    )
)
 
Upvote 0
It's difficult to provide a complete answer because the screenshot of your desired output contains fields not visible in your employee table or your holiday/schedule table (Project ID, Customer ID, Booking Type ID and Project Task ID). However, the generic syntax would look something like this:

Excel Formula:
=LET(
    array1, tblEmployees,
    array2, tblHolidays,
    a, SEQUENCE(ROWS(array1)),
    b, SEQUENCE(, ROWS(array2)),
    HSTACK(
        CHOOSEROWS(array1, TOCOL(IF(b, a))),
        CHOOSEROWS(array2, TOCOL(IF(a, b)))
    )
)

Replace "tblEmployees" and "tblHolidays" with the actual ranges/arrays that you want to be repeated. You could also use CHOOSECOLS to select and/or rearrange the desired columns, if necessary. For example:

Excel Formula:
=LET(
    array1, tblEmployees[Internal id],
    array2, CHOOSECOLS(tblHolidays,5,6,7,2),
    a, SEQUENCE(ROWS(array1)),
    b, SEQUENCE(, ROWS(array2)),
    HSTACK(
        CHOOSEROWS(array1, TOCOL(IF(b, a))),
        CHOOSEROWS(array2, TOCOL(IF(a, b)))
    )
)
Thanks, I'll give it a shot.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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