BYCOL function in Google Sheets
Groups an array by columns by application of a LAMBDA function to each column.
=BYCOL(array_or_range, LAMBDA)BYCOL syntax and parameters
Two arguments, two required.
- array_or_rangeanyRequired
An array or range to be grouped by columns.
- LAMBDAanyRequired
A LAMBDA that’s applied to each column in the given array or range to obtain its grouped value. Syntax: LAMBDA(name,formula_expression) Requirements: The LAMBDA must have exactly 1 name argument along with a formula_expression which uses that name. The name resolves to the current column being grouped when the LAMBDA is applied.
BYCOL examples
Formulas you'll actually reuse.
A totals row for twelve monthly columns in one formula:
=BYCOL(B2:M13, LAMBDA(col, SUM(col)))The spread (max minus min) of each month's figures:
=BYCOL(B2:M13, LAMBDA(col, MAX(col) - MIN(col)))
BYCOL in Excel
Same name — your formula ports as-is.
Try BYCOL in the playground
Edit the example — nothing to install.
Preloaded with the BYCOL formula from Example 1 — change anything and watch it respond.
Related functions
More ways Google Sheets gets this done.
- BYROWGroups an array by rows by application of a LAMBDA function to each row.ArrayExcel
- CHOOSECOLSCreates a new array from the selected columns in the existing range.ArrayExcel
- CHOOSEROWSCreates a new array from the selected rows in the existing range.ArrayExcel
- HSTACKAppends ranges horizontally and in sequence to return a larger array.ArrayExcel
- LINESTGiven partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.ArrayExcel
- MAKEARRAYReturns an array of specified dimensions with values calculated by application of a LAMBDA function.ArrayExcel