A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Use the INDEX expression directly inside BYCOL and coerce the text values to zero inside the LAMBDA.
For example, with the 2‑D grid returned by
=INDEX($A:$AZ,ROW(G3:G5),COLUMN(G3#))
a BYCOL that sums only values > 0 and ignores text can be written as:
=BYCOL(
INDEX($A:$AZ,ROW(G3:G5),COLUMN(G3#)),
LAMBDA(c,
SUM(IF(c>0,c))
)
)
Explanation:
-
INDEX($A:$AZ,ROW(G3:G5),COLUMN(G3#))returns a single 2‑D array, so BYCOL receives one array (no array‑of‑arrays, so no#CALC!). - Inside the LAMBDA,
IF(c>0,c)builds an array that contains each positive number andFALSEfor everything else (negative numbers, zeros, and text). -
SUMignores the non‑numericFALSEvalues, so text is effectively ignored while only positive numbers are summed.
If needed, the same pattern can be adapted to other aggregate functions, for example:
=BYCOL(INDEX($A:$AZ,ROW(G3:G5),COLUMN(G3#)),LAMBDA(c,AVERAGE(IF(c>0,c))))
(entered as a dynamic array formula).
References: