Search code examples
excelexcel-formulasumaveragecalculated-columns

Sum of every 10th cell in a Row of Excel and not allowing after the nth row cell


I am trying to compute the sum of every 10th Row of EXCEL. My file has around 9000 rows (let's say N) and I do not want the sum to include cells beyond Nth cell.

Let's say N=30 for simplicity. So I want the sum of #1 (15), #10 (72), #20 (76) and #30 (86).

List    Numbers  SUM
1   15       249
2   9        243        
3   40
4   79
5   22
6   63
7   93
8   66
9   69
10  72
11  43
12  95
13  88
14  10
15  48
16  55
17  23
18  21
19  9
20  76
21  83
22  45
23  27
24  14
25  88
26  24
27  80
28  69
29  57
30  86

Excel Snapshot

I am using the command =SUM(X2,X2:X31*(MOD(ROW(X2:X31)-1,10)=0)).

The first value is coming correct (249). But the second value, where I want to add (9+43+83) is WRONG. Can anyone please help me with this for a large set of numbers?


Solution

  • Sum Up Every N-th Row

    =LET(Data,X2:X31,Nth,10,
        rCount,ROWS(Data),
    MAP(SEQUENCE(Nth),LAMBDA(r,
        SUM(INDEX(Data,SEQUENCE(INT((rCount-r)/Nth)+1,,r,Nth))))))
    
    =SUM(X2:X$31*(MOD(ROW(X2:X$31)-2,10)+1=ROW()-1))
    

    enter image description here