Forum Discussion

ronblaisdell's avatar
ronblaisdell
Copper Contributor
Mar 28, 2024

GROUPBY aggregating more than one column of data

In the early versions of Excel beta, we were able to create a formula like this:

 

 

=GROUPBY(Table[Code], Table[[Duration]:[Expense]], SUM, 3)

 

 

and this worked just fine.

 

But now, the lambda SUM function is coming up with a #NAME error, even when I use the formula builder.

 

Excel version:

Microsoft Excel for Microsoft 365 MSO (Version 2404 Build 16.0.17521.20000) 64-bit

 

Example attached.

1 Reply

  • paulphoto's avatar
    paulphoto
    Copper Contributor

    I found a solution, easy as:  just use HSTACK to pass multiple arrays to the GROUPBY first argument.  An example that works:

    =GROUPBY(HSTACK(
    tblBillingData[Account Number],
    tblBillingData[Item],
    tblBillingData[Remark]),
    tblBillingData[GST Exclusive],SUM,0,0,1,
    )

    What I haven't figured out yet is how to return sum(amount) and sum(units).

Resources