+ Reply to Thread
Results 1 to 9 of 9

Average of range between two specified cells

  1. #1
    Registered User
    Join Date
    05-06-2016
    Location
    Copenhagen, Denmark
    MS-Off Ver
    MS 2013
    Posts
    27

    Average of range between two specified cells

    Hi,

    I'd like to have Excel take the average of the "total no. of cakes" and "no. of cakes w. mistakes", respectively, for the last twelve months of data. I could just do this manually by writing "=AVERAGE(B3:B14)" in F5 and "=AVERAGE(C3:C14)" in F8, respectively. However, I'd like to minimize the amount of manually writing in information, so that I only have to insert new data (next time 16-05) and write in the current month and the same month last year.

    So my question is: Is there a way to have Excel take the average of the cells in row B below row A containing the value from F2 and above row A containing the value from F3?

    Best regards
    Kasper
    Attached Images Attached Images
    Last edited by KasperMikkelsen; 05-06-2016 at 09:31 AM.

  2. #2
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Average of range between two specified cells

    Hi
    Welcome to the forum.

    I am not very sure what are your requirements but try if this is what you need.

    For column B average use-
    Please Login or Register  to view this content.
    For column C average use-
    Please Login or Register  to view this content.

    Also, as you are new to the forum I would like to tell you that we can upload workbooks at this forum which provide better flexibility than attaching images.
    Check out the link in my signature below to know how you can attach workbooks at this forum.
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Average of range between two specified cells

    How about

    Total cakes
    =SUMPRODUCT(--(F2>=A2:A16)*(F3<=A2:A16)*(B2:B16))/COUNTIFS(A2:A16,"<="&F2,A2:A16,">="&F3)

    Total cakes with mistakes
    =SUMPRODUCT(--(F2>=A2:A16)*(F3<=A2:A16)*(C2:C16))/COUNTIFS(A2:A16,"<="&F2,A2:A16,">="&F3)
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Average of range between two specified cells

    If the month and year is in the correct format (not text) then you can also use this-
    =AVERAGEIFS(B:B,A:A,"<="&F2,A:A,">="&F3)

  5. #5
    Registered User
    Join Date
    05-06-2016
    Location
    Copenhagen, Denmark
    MS-Off Ver
    MS 2013
    Posts
    27

    Re: Average of range between two specified cells

    sourabhg98: I've tried using your first formula, i.e. "=AVERAGE(INDIRECT("B"&MATCH(F2,A:A,0)&":"&"B"&MATCH(F3,A:A,0)))"

    However, the number I get for the B row is slightly off (56.84615 instead of 55.91667) and the same goes for the C row.

    I have uploaded my Excel-file.

    Thank you guys so much for your attempts so far!
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-06-2016
    Location
    Copenhagen, Denmark
    MS-Off Ver
    MS 2013
    Posts
    27

    Re: Average of range between two specified cells

    Special-K: When using your SUMPRODUCT function, I get the error message #DIV/0!

  7. #7
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Average of range between two specified cells

    or can use F5
    Please Login or Register  to view this content.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Average of range between two specified cells

    or can try F5
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-06-2016
    Location
    Copenhagen, Denmark
    MS-Off Ver
    MS 2013
    Posts
    27

    Re: Average of range between two specified cells

    nflsales: Thank you so much, that worked perfectly!

+ 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. Average of cells in range if there is a date
    By inputchip in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2014, 06:15 PM
  2. Replies: 3
    Last Post: 10-31-2013, 04:50 AM
  3. [SOLVED] Average of Cells in Range (Using First 4 Cells With Data)
    By amonty78 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-31-2013, 10:34 PM
  4. [SOLVED] Finding the average of a range of cells
    By Adam845 in forum Excel General
    Replies: 3
    Last Post: 09-26-2012, 02:06 PM
  5. Replies: 1
    Last Post: 07-27-2012, 05:37 PM
  6. How to find the average of a range of cells?
    By anon in forum Excel General
    Replies: 6
    Last Post: 06-10-2012, 03:56 PM
  7. [SOLVED] How do I average a range of cells when one cell contains #N/A
    By hongkonglt in forum Excel General
    Replies: 3
    Last Post: 09-18-2005, 10:05 PM

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