Pivot or Other Solution required to transform the data

aamaramaster

New Member
Joined
Oct 3, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi, I attached a photo for a data set I have called" Original Data" where I want to create a Pivot table or any other simple solution to create a new data table as show in the attached photo below:

1727931503560.png
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hello, one option could be:

Excel Formula:
=LET(
ID,A5:A22,
names,B5:B22,
u,UNIQUE(ID),
t,IFNA(DROP(REDUCE("",u,LAMBDA(x,y,VSTACK(x,TRANSPOSE(UNIQUE(FILTER(names,ID=y)))))),1),""),
HSTACK(u,t))
 
Upvote 1
Solution
Hi & welcome to MrExcel.
Another option
Excel Formula:
=LET(u,UNIQUE(FILTER(A2:A100,A2:A100<>"")),m,MAX(COUNTIFS(A:A,u)),REDUCE(HSTACK("Order ID","Name "&SEQUENCE(,m)),u,LAMBDA(x,y,VSTACK(x,HSTACK(y,EXPAND(TOROW(FILTER(B2:B100,A2:A100=y)),,m,""))))))
 
Upvote 1
Hi & welcome to MrExcel.
Another option
Excel Formula:
=LET(u,UNIQUE(FILTER(A2:A100,A2:A100<>"")),m,MAX(COUNTIFS(A:A,u)),REDUCE(HSTACK("Order ID","Name "&SEQUENCE(,m)),u,LAMBDA(x,y,VSTACK(x,HSTACK(y,EXPAND(TOROW(FILTER(B2:B100,A2:A100=y)),,m,""))))))
Thank you; it works, but the issue is that it retains duplicate names, as shown in the attached file. The previous formula from @hagia_sofia effectively eliminated the duplicates.
1727971675891.png
 
Upvote 0
Another possibility with the new PIVOTBY function:

Excel Formula:
=LET(
    a, UNIQUE(FILTER(A5:B1000,A5:A1000<>"")),
    r, CHOOSECOLS(a,1),
    v, CHOOSECOLS(a,2),
    n, SEQUENCE(ROWS(a)),
    c, MMULT((n>=TOROW(n))*(r=TOROW(r)),n^0),
    p, PIVOTBY(r,c,v,CONCAT,0,0,,0),
    VSTACK(HSTACK("Order ID","Name "&DROP(TAKE(p,1),,1)),DROP(p,1))
)
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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