LAMBDA: SumColumnsλ

Description

Returns a an array of totals by column in a two dimensional array.

There are many situations where we have numbers in an array that need to be totaled by column. In the simple example above, we are totaling scheduled construction costs by day.

Syntax

We see this LAMBDA being use in the GIF.:

=SumColumnsλ( <Array> )

Where:

  • Array - is a two dimensional array of values

Code

This is the code as of this writing. This is a good example of how to use BYCOL. For the most current version, see the Gist.

/*

FUNCTION NAME: SumColumnsλ

DESCRIPTION: Returns a vector array of totals by column over a two dimensional array

EXAMPLE: =SumColumnsλ(daCalcs)

ARGS:

Array A two dimensional array of values


GUILTY PARTIES: Various Others 2022

*/


SumColumnsλ = LAMBDA(

// Parameter Declarations

Array,


// Function starts here

BYCOL(

Array,

LAMBDA(Column, SUM(Column))

)

);

Importing

Use the Advance Formula Environment add-in available (free) from the Microsoft store (use Developer tab > Add-ins icon > This LAMBDA is available for download. Click Advanced Formula Environment to learn more about that.

All of my LAMBDAs can be found here: https://gist.github.com/CHatmaker.

This specific LAMBDA is part of a Dates library at this URL:

https://gist.github.com/CHatmaker/3e1708888ec2bd1cde2ec9d002dc459b