With the number 3 in cell F5 for n, the result is 70.

### Example formula

In the example shown, the formula in cell F6 is: At a high level, this formula uses the FILTER function to extract values associated with every nth row of the data, and the SUM function to sum the values extracted.

### Extracting data

Working from the inside out, the first step in this problem is to collect the data that should be summed. This is done with the FILTER function like this: where include represents the formula logic needed to target every nth value (every 3rd value in the example). To construct the logic we need, we use a combination of the MOD function, the SEQUENCE function, and the ROWS function: The ROWS function returns the count of rows in the range B5:B16, which is 12: With 12 as the rows argument, the SEQUENCE function returns a numeric array of 12 numbers like this: Substituting the array above and the value for n (3) into the formula we have: The MOD function returns the remainder of each number in the array divided by 3: The result from MOD is compared to zero, which creates an array of TRUE and FALSE values: Note that every third value is TRUE. This is the value returned to FILTER as the include argument. FILTER uses this array to “filter” values in the range B5:B16. Only values associated with TRUE make it through the filter operation. The result is an array that contains every 3rd value in the data. Since there are 12 values total, FILTER returns 4 values: FILTER delivers this array of values directly to the SUM function, which returns the sum (70) as a final result: This formula is dynamic. For example, if the value for n in cell F5 is changed to 2 (every 2nd value) the new result is 120.

### Legacy Excel formula

In older versions of Excel that do not include the FILTER or SEQUENCE functions, you can use a different formula based on the SUMPRODUCT function: The concept is similar to the formula explained above but the approach is different. Rather than extract values of interest from the data, this formula “zeros out” the other values not of interest. First, the formula uses the ROW function to construct a relative set of row numbers: The result is a numeric array like this: Inside the SUMPRODUCT function, we again use the MOD function to construct a filter: MOD returns an array of TRUE FALSE values like this: Again, note that every 3rd value is TRUE. A double negative (–) is used to convert the TRUE and FALSE values to 1s and 0s. Back in the SUMPRODUCT, we now have: The SUMPRODUCT then multiplies the two arrays together and returns the sum of products. Only the values in B5:B6 that are associated with 1s survive this operation, the other values are “zeroed out”: The final result is 70. This formula is also dynamic. If the value for n in cell F5 is changed to 2 (every 2nd value) the new result is 120.

### Dave Bruns

Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.