Logical functions

BYCOL

Matches all 32 recorded answers

Recorded: 32 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicBYCOL
BulgarianBYCOL
CzechBYCOL
DanishBYCOL
GermanBYCOL
GreekBYCOL
English (Australia)BYCOL
English (United Kingdom)BYCOL
English (United States)BYCOL
SpanishBYCOL
EstonianBYCOL
FinnishBYCOL
FrenchBYCOL
HebrewBYCOL
CroatianBYCOL
HungarianBYCOL
IndonesianBYCOL
ItalianBYCOL
JapaneseBYCOL
KoreanBYCOL
LithuanianBYCOL
LatvianBYCOL
NorwegianBYCOL
DutchBYCOL
PolishBYCOL
Portuguese (Brazil)BYCOL
Portuguese (Portugal)BYCOL
RomanianBYCOL
RussianBYCOL
SlovakBYCOL
SlovenianBYCOL
Serbian (Latin)BYCOL
SwedishBYCOL
ThaiBYCOL
TurkishBYCOL
UkrainianBYCOL
VietnameseBYCOL
Chinese (Simplified)BYCOL
Chinese (Hong Kong)BYCOL
Chinese (Traditional)BYCOL

Names from Microsoft's support site.

What it does

BYCOL(array, lambda)

BYCOL(array, lambda) applies a one-parameter lambda to each entire column and returns one result per column in a single row. An input with r rows and c columns therefore produces one row with c results when every invocation returns one value.

=BYCOL({1,2;3,4},LAMBDA(col,SUM(col))) returns the row {4,6}. Each invocation sees a column, not one cell at a time.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

Change SUM(col) to MAX(col) or AVERAGE(col) in the example. Compare the shape with =BYROW({1,2;3,4},LAMBDA(row,SUM(row))).

Quirks

The lambda must accept one parameter and produce one result per column. Microsoft's documented errors distinguish incorrect parameters (#VALUE!) from failure to produce a single value (#CALC!). BYCOL does not create a row of nested arrays.

A direct error can stop the helper before its lambda is checked. On the recorded build, BYCOL(#N/A,#VALUE!) is #N/A, while BYCOL({#N/A},2) is #VALUE!. The latter supplies an array element but no valid lambda. This distinction matters when validating arguments.

A direct error stops these array functions; the same error in an array or cell is an element

An error written directly as an argument of these functions is the answer for the whole call. It is not placed in the result: HSTACK(1,#VALUE!) is #VALUE!, not a row holding 1 and an error, and TAKE(#N/A,0) is #N/A. With MAP the LAMBDA does not run at all: MAP(NA(),LAMBDA(xx,IFERROR(xx,3))) is #N/A. The same error inside an array, or in a referenced cell, is an ordinary element: MAP({#N/A},LAMBDA(xx,3)) is 3, and HSTACK(Data!C1,{1;2}) with #N/A in Data!C1 is a 2 by 2 array with #N/A in its first column. TOCOL and TOROW show the difference with ignore 2: TOCOL(#N/A,2) is #N/A, while TOCOL({#N/A},2) drops the error, has nothing left, and is #CALC!. EXPAND is an exception on the cell side: EXPAND(Data!C1,2,2,"pad") is #N/A for the whole call. BYROW and BYCOL check the direct error first too: BYROW(#N/A,#VALUE!) is #N/A, while BYROW({#N/A},2), where 2 is not a LAMBDA, is #VALUE!.

FormulaExcelMathematical value
=HSTACK(1,#VALUE!)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#VALUE!—
=TAKE(#N/A,0)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#N/A—
=MAP(NA(),LAMBDA(xx,IFERROR(xx,3)))
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#N/A—
=MAP({#N/A},LAMBDA(xx,3))
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

3
0x4008000000000000
—
=HSTACK(Data!C1,{1;2})
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Number supplied through a cell.

Data!C1: #N/A

{#N/A,1;#N/A,2}—
=TOCOL(#N/A,2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#N/A—
=TOCOL({#N/A},2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#CALC!—
=EXPAND(Data!C1,2,2,"pad")
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Number supplied through a cell.

Data!C1: #N/A

#N/A—
=BYROW(#N/A,#VALUE!)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#N/A—
=BYROW({#N/A},2)
Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
Inputs and reference value

Typed formula.

#VALUE!—

Inputs, build details and evidence

How to implement

Retain the input's two-dimensional shape. For each column, expose a column-shaped view to the callable, bind its one parameter, evaluate the body and store its scalar answer in that column of a one-row output. Avoid copying the whole input for every invocation.

Preserve references where the callable's operation needs them. Detect direct argument errors at the appropriate stage, then validate the callable and its arity. Reject nested-array results through the helper's result rule rather than flattening them silently. Keep errors returned as individual scalar results in their output positions.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

BYCOL · 1 lines · calc-func/src/catalogue/lambda_helpers.rs on GitHub
5 bycol_fn "BYCOL" (2, 2) [R "array", R "lambda"] resume bycol_resume => bycol_start; |s, a, sv| { run(s, bycol_start(s, a, sv), sv) }
bycol_start · 7 lines · calc-func/src/catalogue/lambda_helpers.rs on GitHub
fn bycol_start(
    site: &Site<'_>,
    a: &[CalcValue],
    sv: &mut EvalServices<'_>,
) -> Step<Box<dyn KernelTask>> {
    by_task(site, a, sv, true)
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

Microsoft lists BYCOL for Microsoft 365 and Excel 2024 on Windows and Mac. Build observations below cover direct errors. Other differences between named builds have not been characterized here.

Alternatives

BYROW applies a lambda to rows and returns a column. MAP visits individual positions and preserves the input shape. A direct SUM of a single column is shorter when only one column needs aggregating.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents