SUMPRODUCT (with criteria) first N even rows in a column and then AVERAGE

LeAnneaux

New Member
Joined
Aug 27, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi, I’m trying to average the total minutes of the first N -- in this case, 3 in lieu of N -- movies watched by a client. Please see my sheet:

docs.google.com/spreadsheets/d/1oTwnB5u7y4KqAwamvjsEats3JiTPpYhEkOqUvOzEkDE

In column A, you can see the extracted numbers from the minutes texts so that it will add up. Column B is where the movie titles along with their duration that the customer can mark Complete using the dropdown in column C. The formula, found in cell E14, I’ve used to average the said minutes is:

Excel Formula:
=SUMPRODUCT((MOD(ROW(A2:A)-ROW(A2),2)=0)*(C2:C="Complete")*(AVERAGE(OFFSET(A2:A,0,0,3))))

However, it returns an error saying the “AVERAGE caused a divide by zero error.”

Thanks for reading
LeAnneaux
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Welcome to MrExcel Message Board.
Try this Formula:
Excel Formula:
=AVERAGE(OFFSET($A$2,(ROW(A2)-ROW($A$2))*3,,9,))

9 = 3 * 3 (Interval Between Rows)
 
Upvote 0
Your formula result didn't recognize as number. I change formula to result be number at column A. then add 2 other formula at sheet to see result at E15 & E16.

Excel Formula:
=AVERAGE(OFFSET($A$2,(ROW(A2)-ROW($A$2))*2,,2*N))
Excel Formula:
=AVERAGE(INDEX(A:A,2+2*(ROW(A2)-ROW($A$2))):INDEX(A:A,2*N))

At these Formulas N can be replaced with First N numbers.
 
Upvote 0
Also I add one simpler formula to do exact work for Column A:
Excel Formula:
IF(MOD(ROW(),2)=0,LEFT($B3,FIND(" ",$B3)-1)*1,"")
if you want result by Minutes Format change it to:
Excel Formula:
IF(MOD(ROW(),2)=0,LEFT($B3,FIND(" ",$B3)-1)/1440,"")
 
Upvote 0
I appreciate you going above and beyond! Though it’s missing that one tiny problem which is matching the specific criterion, as indicated in my post (C2:C="Complete").
 
Upvote 0
These Formulas At Post #4 can be used Column A.

Then Use this formula at E14. your sumproduct formula give wrong results.

if used Office365 don't need Press CTRL+SHIFT+ENTER
Excel Formula:
=AVERAGEIFS((OFFSET($A$2,,,SMALL(IF("Complete"=$C$1:$C$200,ROW($C$1:$C$200)),3))),(OFFSET($C$2,,,SMALL(IF("Complete"=$C$1:$C$200,ROW($C$1:$C$200)),3))),"Complete")

Book1
ABCDEFGH
1DurationTitleStatus
290Don Jon (2013)
3 90 minutes
490Last Breath (2019)Complete
5 90 minutes
6114Fear Street Part Three: 1666 (2021)
7 114 minutes
8137Terminator 2: Judgment Day (1991)Complete
9 137 minutes
10126Hugo (2011)Complete
11 126 minutes
12
13Average Minutes of First 3 Movies Watched:
14117.66667
15
16
Sheet1
Cell Formulas
RangeFormula
A2:A11A2=IF(MOD(ROW(),2)=0,LEFT($B3,FIND(" ",$B3)-1)*1,"")
E14E14=AVERAGEIFS((OFFSET($A$2,,,SMALL(IF("Complete"=$C$1:$C$200,ROW($C$1:$C$200)),3))),(OFFSET($C$2,,,SMALL(IF("Complete"=$C$1:$C$200,ROW($C$1:$C$200)),3))),"Complete")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hey sorry to bother you again, but I’m not sure where I went wrong? It says argument must be a range.

argumentmustberange.png
 
Upvote 0
Please Paste Full formula here to I can see & check it? this is my last formula:
Excel Formula:
=AVERAGEIFS((OFFSET($A$2,,,SMALL(IF("Complete"=$C$1:$C$200,ROW($C$1:$C$200)),3))),(OFFSET($C$2,,,SMALL(IF("Complete"=$C$1:$C$200,ROW($C$1:$C$200)),3))),"Complete")
 
Upvote 0
For Sheets, try:

Excel Formula:
=average(filter(A2:A,C2:C="Complete",ROW(A2:A)<=LARGE(FILTER(ROW(A2:A),C2:C="Complete"),3)))
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top