Duplicate row based on cell with text separated by semicolon

esmarques

New Member
Joined
Oct 27, 2020
Messages
37
Office Version
  1. 365
Platform
  1. MacOS
Hello,
Could anybody help with finding a solution / formulas to help me find a way of duplicating a row as many times as there are unique text values, separated by semicolons, in a cell in that row?
The amount of rows will varies as it will be downloaded from a database as often as needed so ideally I would need the formulas in a second worksheet so I can then just copy and paste the data into Data sheet.
In the worksheet attached, this text is in column F. And if there is no data in Column F, just leave it as it is.
So for example, in F2 there are 5 names separated by semicolon so I would like for this to expand to 5 rows with each of these names in Column F and all the other data from that row copied as the example also in the worksheet.

I have added the desired result in "Data expanded" worksheet.

I use Office 365 in a Mac.
Any help welcomed.

Please let me know if you need any further information.

Thank you very much.

Data Worksheet:
Volunteers hs and support.xlsx
ABCDEFGHIJKLMNO
1Resource Booking StartResource Booking EndQuantitySupplierEvent ReferenceStaffEvent DateActivity DetailArrangement ReferenceDescriptionDate [Required]Event StatusResourceResource TypeArrangement Type
24/6/24 8:304/6/24 17:1510Supplier12524Caudwell, Anne-marie; Edmonds, Jill; Nevarez-Pyrkova, Anastasia; Palmer, Andrea; Roberts, Melanie4/6/24Performance1374Spring event4/6/24ConfirmedVolunteerStaffInternal
34/6/24 8:304/6/24 17:1510Supplier228684/6/24Performance1374Spring event4/6/24ConfirmedVolunteerStaffInternal
45/25/24 18:305/25/24 23:453Supplier32593Palmer, Andrea; Webb, Jude5/25/24Performance3382Live Music ticketed5/25/24ConfirmedVolunteerStaffLive Event - Ticketed
56/22/24 18:306/22/24 23:303Supplier42662Gorman, Janet; Webb, Jude6/22/24Performance4348Live Ticketed event6/22/24ConfirmedVolunteerStaffLive Event - Ticketed
64/27/24 18:304/27/24 22:451Supplier52384Patel, Lina4/27/24Performance4348Live Ticketed event4/27/24ConfirmedVolunteerStaffLive Event - Ticketed
76/29/24 10:006/29/24 14:452Supplier635696/29/24Performance6553Mill Event6/29/24ConfirmedVolunteerStaffNetworking/relationship building
89/21/24 14:309/21/24 23:154Supplier72900Gorman, Janet; Knaggs, Mick; Knaggs, Sarah; Palmer, Andrea9/21/24Performance6458The Vale Third Birthday9/21/24ConfirmedVolunteerStaffLive Event - Ticketed
Data


Data_Expanded worksheet with desired result:
Volunteers hs and support.xlsx
ABCDEFGHIJKLMNO
1EXAMPLE RESULT
24/6/24 8:304/6/24 17:1510Supplier12524Caudwell, Anne-marie4/6/24Performance1374Spring event4/6/24ConfirmedVolunteerStaffInternal
34/6/24 8:304/6/24 17:1510Supplier12524Edmonds, Jill4/6/24Performance1374Spring event4/6/24ConfirmedVolunteerStaffInternal
44/6/24 8:304/6/24 17:1510Supplier12524Nevarez-Pyrkova, Anastasia4/6/24Performance1374Spring event4/6/24ConfirmedVolunteerStaffInternal
54/6/24 8:304/6/24 17:1510Supplier12524Palmer, Andrea4/6/24Performance1374Spring event4/6/24ConfirmedVolunteerStaffInternal
64/6/24 8:304/6/24 17:1510Supplier12524Roberts, Melanie4/6/24Performance1374Spring event4/6/24ConfirmedVolunteerStaffInternal
75/25/24 18:305/25/24 23:453Supplier32593Palmer, Andrea5/25/24Performance3382Live Music ticketed5/25/24ConfirmedVolunteerStaffLive Event - Ticketed
85/25/24 18:305/25/24 23:453Supplier32593Webb, Jude5/25/24Performance3382Live Music ticketed5/25/24ConfirmedVolunteerStaffLive Event - Ticketed
96/22/24 18:306/22/24 23:303Supplier42662Gorman, Janet6/22/24Performance4348Live Ticketed event6/22/24ConfirmedVolunteerStaffLive Event - Ticketed
106/22/24 18:306/22/24 23:303Supplier42662Webb, Jude6/22/24Performance4348Live Ticketed event6/22/24ConfirmedVolunteerStaffLive Event - Ticketed
114/27/24 18:304/27/24 22:451Supplier52384Patel, Lina4/27/24Performance4348Live Ticketed event4/27/24ConfirmedVolunteerStaffLive Event - Ticketed
129/21/24 14:309/21/24 23:154Supplier72900Gorman, Janet9/21/24Performance6458The Vale Third Birthday9/21/24ConfirmedVolunteerStaffLive Event - Ticketed
139/21/24 14:309/21/24 23:154Supplier72900Knaggs, Mick9/21/24Performance6458The Vale Third Birthday9/21/24ConfirmedVolunteerStaffLive Event - Ticketed
149/21/24 14:309/21/24 23:154Supplier72900Knaggs, Sarah9/21/24Performance6458The Vale Third Birthday9/21/24ConfirmedVolunteerStaffLive Event - Ticketed
159/21/24 14:309/21/24 23:154Supplier72900Palmer, Andrea9/21/24Performance6458The Vale Third Birthday9/21/24ConfirmedVolunteerStaffLive Event - Ticketed
164/6/24 8:304/6/24 17:1510Supplier228684/6/24Performance1374Spring event4/6/24ConfirmedVolunteerStaffInternal
176/29/24 10:006/29/24 14:452Supplier635696/29/24Performance6553Mill Event6/29/24ConfirmedVolunteerStaffNetworking/relationship building
Data_expanded
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
simply with Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    trf = Table.TransformColumns(Source,{{"Staff", each try Text.Split(_,"; ") otherwise null }}),
    expand = Table.ExpandListColumn(trf, "Staff"),
    result = Table.SelectRows(expand, each ([Staff] <> null))
in
    result
 
Upvote 0
Hello, thank you for your reply. I am not familiar with Power Query, and also as other members of the team will be using this, is it possible to achieve the result with formulas only?

Thank you
 
Upvote 0
It is not getting easier with a formula though. The formula will give you all the output in a dynamic array

Excel Formula:
=DROP(REDUCE("",F2:F8,LAMBDA(a,b,VSTACK(a,LET(x,IF(b="","",TEXTSPLIT(b,,"; ")),HSTACK(IF({1},OFFSET(b,,-1,,-5),x),x,IF({1},OFFSET(b,,1,,9),x)))))),1)
 
Upvote 0
Solution
It is not getting easier with a formula though. The formula will give you all the output in a dynamic array

Excel Formula:
=DROP(REDUCE("",F2:F8,LAMBDA(a,b,VSTACK(a,LET(x,IF(b="","",TEXTSPLIT(b,,"; ")),HSTACK(IF({1},OFFSET(b,,-1,,-5),x),x,IF({1},OFFSET(b,,1,,9),x)))))),1)
Amazing. It worked perfectly. Thank you very very much.
 
Upvote 0

Forum statistics

Threads
1,224,903
Messages
6,181,647
Members
453,059
Latest member
jkevin

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