+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    08-18-2009
    Location
    Cincinnati
    MS-Off Ver
    Excel 2007
    Posts
    65

    Average row of numbers using different row #'s

    Field 1 input: Beginning Date (e.g 7/17/09)
    Field 2 input: End Date (e.g. 7/23/09)
    Need: Average costs on and between these given dates

    From table with this information:

    Date Market two
    7/16/2009 80
    7/17/2009 80
    7/20/2009 82
    7/21/2009 84
    7/22/2009 82
    7/23/2009 82
    7/24/2009 82
    7/27/2009 82

    I need Excel to average Market two 7/17 to 7/23 (80, 82, 84, 82, 82) based on the dates I give it.

    If I change the date to 7/20 to 7/24, I then need excel to average (82, 84, 82, 82, 82)

    How can I get Excel to average based on different dates? Or basically, how do I get it to pull rows between 2 inputs?

    Thank you much,

    Roger!
    Attached Files Attached Files
    Last edited by bluerog; 08-18-2009 at 11:33 AM.

  2. #2
    Forum Guru zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    5,740

    Re: Average row of numbers using different row #'s

    Try this:

    =SUMPRODUCT(--($A$6:$A$27>=$B$2);--($A$6:$A$27<=$B$3);$B$6:$B$27)/SUMPRODUCT(--($A$6:$A$27>=$B$2);--($A$6:$A$27<=$B$3))

    Replace ; with , if needed
    "Relax. What is mind? No matter. What is matter? Never mind!"

  3. #3
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,163

    Re: Average row of numbers using different row #'s

    Try:

    =AVERAGE(IF($A$6:$A$27>=B2,IF($A$6:$A$27<=B3,$B$6:$B$27)))

    which must be confirmed with CTRL+SHIFT+ENTER not just ENTER.. you will see { } brackets appear.

    If you are indeed using 2007, then use Averageifs...

    =AVERAGEIFS($B$6:$B$27,$A$6:$A$27,">="&B2,$A$6:$A$27,"<="&B3)
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  4. #4
    Registered User
    Join Date
    08-18-2009
    Location
    Cincinnati
    MS-Off Ver
    Excel 2007
    Posts
    65

    Re: Average row of numbers using different row #'s

    Brilliant--both of you. I'll use NBVC solution though. If I get a blank square of data, I get the incorrect average using sumproduct.

    You guys rule. And thank you much.

    Roger!

  5. #5
    Forum Moderator NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003, 2007, 2010
    Posts
    31,163

    Re: Average row of numbers using different row #'s

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

Thread Information

Users Browsing this Thread

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

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.2.0