Forum Discussion

richzip1's avatar
richzip1
Copper Contributor
Jul 03, 2021
Solved

Sum of variable number of rows

Hello, I would like to find a formula that will take the total of a column -- but the number of rows in that column will vary.  The attachment hopefully helps to visualize how the totals should be gr...
  • Lorenzo's avatar
    Jul 03, 2021

    richzip1 

    A formula solution that assumes data are exactly as in your sample

     

    in F2 and copy right then down:

    =IF(
        AND(ISNUMBER($B2),ISNUMBER($C2)), D2,
        IF(ISNUMBER($B2), SUM(OFFSET($D2,,COLUMNS($F:F)-1,MATCH(INT($B2), INT($C2:$C15),0))), "")
    )

    and validate it with CTRL+SHIFT+ENTER (or its equiv on Mac) if you don't run Excel 365/Web

    Corresponding sample attached

Resources