Share via

SumIF ByColumn, looking through an INDEX array

M L 20 Reputation points
2026-03-31T14:36:57.8766667+00:00

Hi,

I'm trying to SUMIF the values in a column are greater than 0. I've created a range/array (sorry - not sure which I've created) by using INDEX to get a 2D grid.

User's image A1:D3 was created using an index =INDEX($A:$AZ,ROW(G3:G5),COLUMN(G3#))

The BLUE Spilled Range was created using =BYCOL(A1#,LAMBDA(c,SUMIF(c,">0")))

Question: Instead of referencing A1#, how can I get the INDEX result into the ByCol formula? I'm currently getting a #CALC error because of an array of arrays.

I was partially successful with the GREEN Spilled Range by using SumProduct =BYCOL(INDEX($A:$AZ,ROW(G3:G5),COLUMN(G3#)),LAMBDA(c,SUMPRODUCT(c*(c>0))))

But I can't get SumProduct to ignore texts.

Thank you all.

Microsoft 365 and Office | Excel | For business | Windows

Answer accepted by question author
  1. Q&A Assist
    2026-03-31T14:37:18.0366667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    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 and FALSE for everything else (negative numbers, zeros, and text).
    • SUM ignores the non‑numeric FALSE values, 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:

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.