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...
Lorenzo
Silver Contributor
Another Power Query option (attached)
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
SplitByLineFeed = Table.ExpandListColumn(
Table.TransformColumns(Source,
{"Job", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv),
let
itemType = (type nullable text) meta [Serialized.Text = true]
in
type {itemType}
}
),
"Job"
),
GroupedJobCount = Table.Group(SplitByLineFeed, {"Job"},
{"JOB_COUNT", each Table.RowCount(_), Int64.Type}
),
FilteredJobCount = Table.SelectRows(GroupedJobCount, each [JOB_COUNT] > 1),
RemovedJobCount = Table.RemoveColumns(FilteredJobCount,{"JOB_COUNT"}),
MergedTables = Table.NestedJoin(
RemovedJobCount, {"Job"},
SplitByLineFeed, {"Job"},
"COMMON", JoinKind.Inner
),
ConcatClients = Table.AddColumn(MergedTables, "Clients", each
Text.Combine([COMMON][Client], ", "), type text
),
RemovedColumn = Table.RemoveColumns(ConcatClients,{"COMMON"})
in
RemovedColumn
SergeiBaklan
Jan 05, 2023MVP
Again, I'm not sure the job is like "B20-674A", not "B20". Based on the sample within the text of initial post.
- LorenzoJan 05, 2023Silver Contributor
I'll be glad to fix my mistake but I don't see where it is, or I misunderstood what's expected
Let's see what BusterCLARK has to say...
- SergeiBaklanJan 05, 2023MVP