Forum Discussion
BusterCLARK
Jan 04, 2023Copper Contributor
Need Help with Excel Spreadsheet
I am trying to find client names (Column B) that are associated with the same jobs numbers that are column C and paste all the names in a new column. For Example: Jon Doe - B20-999A Jim Doe - B1...
Patrick2788
Jan 05, 2023Silver Contributor
Here's my entry:
'Header to be applied
Header
={"ID", "Name"}
'Dynamic range for ID column
IDCol
=LET(c, Sheet2!$C$1:$C$10000, nonblank, COUNTA(c), TAKE(c, nonblank))
'Dynamic range for Name Column
NameCol
=LET(b, Sheet2!$B$1:$B$10000, nonblank, COUNTA(b), TAKE(b, nonblank))
'Split IDs on carriage return and stack.
IDStack(a, v)
=LET(split, TEXTSPLIT(v, , CHAR(10)), VSTACK(a, split))
'Create a new ID column
NewIDCol
=DROP(REDUCE("", IDCol, IDStack), 1)
'Resize Name Column based on how many carriage returns are in ID Col for a given name.
NStack(a, v)
=VSTACK(a, EXPAND(v, ROWS(TEXTSPLIT(XLOOKUP(v, NameCol, IDCol, ""), , CHAR(10))), , v))
'Put together a new Name Column
NewNameCol
=DROP(REDUCE("", NameCol, NStack), 1)
'The final stack.
FStack(a, v)
=LET(f, FILTER(NewNameCol, NewIDCol = v), VSTACK(a, HSTACK(v, TEXTJOIN(", ", , f))))
'sheet level formula
=REDUCE(Header,UNIQUE(NewIDCol),FStack)