Apr 26 2023 12:12 PM
Hello everyone!
I have a table with Contact IDs in column A, and portfolios in column B that are to be assigned to the contact ID. As you can see, there are duplicate contact IDs. I need to reduce the sheet where only ONE contact ID is present in column A and the portfolios assigned are transposed into columns.
My actual sheet has over 1000 contact IDs and having to manually transpose the portfolios in column B will take me a significant amount of time. I am curious if there is possibly a formula perhaps that can identify every instance where a specific ID is populated and grab the portfolio and place it in it's own column. Sort of like an expanded vlookup? Please see below sample (no confidential information shown), of what I am in need of:
Current sheet:
The output I need (column title isn't much of a concern I can easily add more, it's the transposing that is what will take a lot of effort):
Thank you!
Apr 26 2023 12:23 PM
SolutionIf you're using Excel 365...
=DROP(
REDUCE(
"",
UNIQUE(CID),
LAMBDA(a, v, LET(filtered, FILTER(AID, CID = v), IFERROR(VSTACK(a, HSTACK(v, TOROW(filtered))), "")))
),
1
)
Apr 26 2023 12:36 PM
Apr 26 2023 12:50 PM
Apr 26 2023 01:05 PM
CID = Contact ID column
AID = Affiliate ID Column
=DROP(REDUCE("",UNIQUE(ContactIDColumn),LAMBDA(a,v,LET(filtered,FILTER(AffiliateIDColumn,ContactIDColumn=v),IFERROR(VSTACK(a,HSTACK(v,TOROW(filtered))),"")))),1)
REDUCE is essentially running each of the contact IDs through a FILTER. The results are being tranposed with TOROW and then some stacking is done with VSTACK/HSTACK.
Apr 26 2023 01:09 PM
Apr 26 2023 01:11 PM - edited Apr 26 2023 01:17 PM
You're welcome! Glad to help.
The attached is taking the extra step to make this a function called 'Analyze'. This function is stored as a named item.
=Analyze(CID,AID)