Home » excel » excel – averaging every nth rows and excluding values

excel – averaging every nth rows and excluding values

Posted by: admin May 14, 2020 Leave a comment


I want to average every 5 rows but also to exclude in the average values that are less than 50. This is the command to average every 5 rows.


This is the command to exclude values less than 50


How do I combine those two in one command?

How to&Answers:

Thanks to a colleague of mine, the following works like a gem.



As long as you have Excel 2016, a SUMPRODUCT formula will work.


I assumed your data was in A1:A100 so update that as needed. And in the MOD formula, I used 5 for ever 5th row. If you need to change that, change the 5 in MOD formulas. Lastly, the formula does not include the value 50 since you stated you wanted less than 50.


‘Tiny’ Differences




Let’s first visualize what you’re actually doing.

enter image description here

For every five rows in column L you are displaying the average of the values, if they are greater than or equal to 50. (in this example) in column G:

For L3:L8 in G2,
for L9:L13 in G3,
for L14:L18 in G4 etc.


  • The 1st issue is that the formula is written exclusively for the
    2nd row. If you want the first result to be displayed in the first row, the formula will result in a REF! error.

    If you want to display the first result in the 1st row you have to
    change L$2 to L$1:


    or for the 3rd row you have to change L$2 to L$3:

  • The 2nd issue is that you are doing something in column L and for
    no obvious reason you are using column P in your formula. You could
    have used any column Z, AN or CG, but your doing stuff in
    column L, so use L.

  • The 3rd issue is that you have locked the columns $L which means where
    ever you put the formula in a single row, the result will be the same. If
    you don’t lock them, you can copy the formula e.g. to the right and
    it will display the results for columns M, N, O etc.:

    enter image description here

Other Formulas


AVERAGEIF is available in Excel from version 2007, but for older versions the following formula can be used instead:


It first checks if COUNTIF results in 0. If it does it displays 0, otherwise it divides SUMIF with COUNTIF.