Transpose Data and Expand Names Based on Courses Pending

Sufiyan97

Well-known Member
Joined
Apr 12, 2019
Messages
1,612
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I have below row data shown as below in sample and I want a formula to populate expected results shown


Book5
ABCDEFGHIJK
1Row DataExpected Result
2NameCourse Name 1Course Name 2Course Name 3Course Name 4Course Name 5NameCourses
3Name 1Course1Course2Name 1Course1
4Name 2Course1Name 1Course2
5Name 3Course1Course2Course3Name 2Course1
6Name 4Course1Course2Course3Course4Course5Name 3Course1
7Name 5Course1Course2Name 3Course2
8Name 3Course3
9Name 4Course1
10Name 4Course2
11Name 4Course3
12Name 4Course4
13Name 4Course5
14Name 5Course1
15Name 5Course2
16
Sheet1
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
I have below row data shown as below in sample and I want a formula to populate expected results shown


Book5
ABCDEFGHIJK
1Row DataExpected Result
2NameCourse Name 1Course Name 2Course Name 3Course Name 4Course Name 5NameCourses
3Name 1Course1Course2Name 1Course1
4Name 2Course1Name 1Course2
5Name 3Course1Course2Course3Name 2Course1
6Name 4Course1Course2Course3Course4Course5Name 3Course1
7Name 5Course1Course2Name 3Course2
8Name 3Course3
9Name 4Course1
10Name 4Course2
11Name 4Course3
12Name 4Course4
13Name 4Course5
14Name 5Course1
15Name 5Course2
16
Sheet1
There is probably a more concise way though.

Book1
ABCDEFGHIJ
1Row DataExpected Result
2NameCourse Name 1Course Name 2Course Name 3Course Name 4Course Name 5NameCourses
3Name 1Course1Course2Name 1Course1
4Name 2Course1Name 1Course2
5Name 3Course1Course2Course3Name 2Course1
6Name 4Course1Course2Course3Course4Course5Name 3Course1
7Name 5Course1Course2Name 3Course2
8Name 3Course3
9Name 4Course1
10Name 4Course2
11Name 4Course3
12Name 4Course4
13Name 4Course5
14Name 5Course1
15Name 5Course2
Sheet1
Cell Formulas
RangeFormula
I3:J15I3=HSTACK(WRAPROWS(TEXTSPLIT(TEXTJOIN(",",TRUE,REPT($A$3:$A$7 & ",",BYROW($B$3:$F$7,COUNTA))),",",,TRUE),1),TRANSPOSE(TEXTSPLIT(TEXTJOIN(",",TRUE,$B$3:$F$7),",",,TRUE)))
Dynamic array formulas.
 
Upvote 0
An alternative is to use Power Query and Unpivot your data

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Name"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Other Columns",{"Attribute"}),
    #"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Value", "Cources"}})
in
    #"Renamed Columns"
 
Upvote 0
Another possibility for Office 365:

Excel Formula:
=LET(
    data, A3:F7,
    labels, TAKE(data,,1),
    values, DROP(data,,1),
    unpvtλ, LAMBDA(area,TOCOL(IFS(values<>"",area),2)),
    HSTACK(unpvtλ(labels),unpvtλ(values))
)

Adjust the data range reference as needed.
 
Upvote 0

Forum statistics

Threads
1,224,698
Messages
6,180,423
Members
452,981
Latest member
MarkS1234

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