+ Reply to Thread
Results 1 to 9 of 9

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

  1. #1
    Registered User
    Join Date
    08-27-2021
    Location
    Americas
    MS-Off Ver
    Office 365
    Posts
    2

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

    Hey there, I’m new. I am trying to average the total minutes of first N -- in this case, 3 -- movies watched by a customer. Please see my sheet (remove spaces in link):
    Please Login or Register  to view this content.
    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 can be marked complete by the customer using the dropdown in column C. The formula, found in cell E14, I’ve used to average the said minutes is:
    Please Login or Register  to view this content.
    However, I received an error saying the “AVERAGE caused a divide by zero error.”

    Appreciate any help,
    Jock

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,213

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

    Welcome to the forum.

    Is this a Google Sheets or Excel query? I am presuming the former.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

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

    heres a different approach that is less complex:

    basically, do a SUM(range)/COUNT(range)

    this way there is no need for any arrays.
    Last edited by janmorris; 08-27-2021 at 09:53 AM.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,213

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

    Sorry for off-topic interjection:

    Although there is no official rule regarding this behavioru, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

  5. #5
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

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

    although google sheets are not downloaded, they are accessed, i understand what you are trying to say.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    81,213

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

    Not quite! Thanks for adding the requested detail, however you still need to provide the link!!!

  7. #7
    Registered User
    Join Date
    08-27-2021
    Location
    Americas
    MS-Off Ver
    Office 365
    Posts
    2

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

    AliGW

    Thanks it is indeed the former as linked in my post. For some reason the tags didn’t show up.

    janmorris

    Yep I initially tried those functions, but they did not work for my use case: It results in 0, and there is no argument that meets a specific criterion.

  8. #8
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

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

    i have duplicated the sheet, reformatted the layout, and provided two working solutions.

    unless you specifically need the text to read "xx minutes", then you can just use col E, but if you really must show "xx minutes" then use col B and C.

    note: the sheet was NOT downloaded, the link is in the OP.
    Attached Images Attached Images
    Last edited by janmorris; 08-27-2021 at 09:43 PM.

  9. #9
    Valued Forum Contributor janmorris's Avatar
    Join Date
    07-24-2021
    Location
    Japan
    MS-Off Ver
    Google Sheets (& Mac 2021)
    Posts
    1,066

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

    the average of the first N (example 3) movies watched is now working

    using an ArrayFormula
    Please Login or Register  to view this content.
    if you want to change the amount, for example the first 4 movies, then you need to change the code a follows:
    Please Login or Register  to view this content.
    if you want the LAST 3 movies watched, then change SMALL to LARGE:
    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by janmorris; 08-28-2021 at 01:45 AM. Reason: earlier method was wrong

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 04-06-2017, 03:42 PM
  2. [SOLVED] Weighted Average Sumproduct Multiple Criteria with Data in One Column
    By azaremb in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-11-2014, 03:14 PM
  3. Average with criteria from other rows
    By KVW in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-30-2014, 09:07 PM
  4. Replies: 6
    Last Post: 11-25-2013, 08:35 PM
  5. Replies: 6
    Last Post: 08-04-2013, 11:53 AM
  6. Replies: 10
    Last Post: 06-28-2012, 08:59 AM
  7. Sumproduct OR adding criteria to Countif, Counta and Average
    By Wkruger in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 02-24-2010, 03:32 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1