Forum Discussion
Multiple If formulas with conditions
This task is best handled by GROUPBY but that function is not yet available in general release of 365.
For now I offer a garden variety Reduce -
=LET(
header, {"ID", "Company", "Plan"},
uniqueID, SORT(UNIQUE(ID)),
Organize, LAMBDA(acc, v,
LET(
details, HSTACK(Company, Plan),
record, FILTER(details, ID = v),
comp, TAKE(record, 1, 1),
joined, ARRAYTOTEXT(TAKE(record, , -1)),
VSTACK(acc, HSTACK(v, comp, joined))
)
),
REDUCE(header, uniqueID, Organize)
)
- HansVogelaarMay 03, 2024MVP
Both replies by Patrick2788 are cell formulas, not VBA. The first one will work in Excel in "regular" Microsoft 365, the second one is currently (early May 2024) only available to Microsoft 365 Insiders.
- Danielle1505May 03, 2024Copper ContributorOh. It looks like VBA coding. I will try it.
- Patrick2788May 03, 2024Silver Contributor
No vba is used. The only thing you may need to account for in the formulas are the named items:
If your data has these defined names, you can plug the formula in and calculate.
PeterBartholomew1 - hats off to the Excel team for PIVOTBY/GROUPBY! I really like how these formulas read with the ETA. The only change I'd make is having the [filter array] argument appear after the 'function' argument.
- Danielle1505May 07, 2024Copper Contributor
- PeterBartholomew1May 08, 2024Silver Contributor
Which formula didn't work? The second uses GROUBY which is only available on the insider's beta channel at the moment. Otherwise REDUCE 5.3 from above should work with non-insider channels.