@ > Home > Contents > Adding parts of a row by parameters Excel 97+

Regard the numbers in row 6:

     A B C D E F G H I J K L M N O P Q R S T U V W X Y Z            
  1      +-        +-        +-        +-    Count 4                
  2  +-+-                                    Shift 2                
  3      +-+-+-+-+-                         Period 5                
  4                +-+-+-                    Width 3                
  5                                                                 
  6    1 3 2 5 2 3 1 8 9 7 1 2 3 4 8 3 2 7 2 1 3 1 7 2 1            
  7                                                                 
  8 88 + + + + + + + + + + + + + + + + + + + + + + + + +            
  9 48   + + +     + + +     + + +     + + +                        

A8: =SUM(6:6) 
adds all numbers of row 6.

A9: {=SUM((6:6)*(MOD(COLUMN(6:6)-1-Shift,Period)<Width)*(COLUMN(6:6)-1>=Shift)*(COLUMN(6:6)-1<Shift+Period*Count))}
adds 4 groups of cells each 3 cells wide. The first cell of a group repeats after 5 cells and the whole starts shifted by 2 cells. 

=SUMPRODUCT((A6:IU6)*... should be considered in terms of speed.

{=SUM((D1:D999)*(MOD(ROW(1:999)-1-Shift,Period)<Width)*(ROW(1:999)-1>=Shift)*(ROW(1:999)-1<Shift+Period*Count))}
is the way for a column, respectively. "Width" now is "Height".