+ Reply to Thread
Results 1 to 4 of 4

Moving down cells until date changes then calculate average

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    8

    Moving down cells until date changes then calculate average

    I have done a little preliminary searching for a solution to this but I couldn't quite articulate it in a short enough manner to find what I was looking for.

    I have data sorted by date (Col A), gas test (Col B), oil test (Col C). The problem is there are a couple of dates that have multiple test results anywhere from 2-4 results per day.

    So I need a formula in Col D that will check the date and if it is the same date as the one above it checks the next cell below it and so forth until it finds a date that is the next day and then will create an average of the gas test results of all the cells that it found as the same date. (And then replicate this formula again of course for the oil test results in Col E).

    I was using an IF formula but could be overlooking something as the formulas are not my strong suit.

    Thanks.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: Moving down cells until date changes then calculate average

    Take a look using the AVERAGEIF() function for this

    =AVERAGEIF(date-range,date-cell,data-range)
    =AVERAGEIF($A$1:$A$100,A1,$B$1:$B$100)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-09-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Moving down cells until date changes then calculate average

    Couldn't seem to get the =AVERAGEIF formula to work with the ranges. I attached a sample of my data. So I'm trying to get the formula I can copy down in columns D and E to look at the dates so 1/1/2013 until it changes to 1/2/2013 and then take an average of the data from 1/1/2013.

    Any help would be appreciated. Thanks.

    forum sample.xlsx

  4. #4
    Registered User
    Join Date
    11-09-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Moving down cells until date changes then calculate average

    Still trying to get the formula to work to take averages of the days as the next day changes. Don't know how to format the criteria where a new day is added to the date (i.e. 1/1/2013 --> 1/2/2013). Any help?

+ 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: 15
    Last Post: 05-26-2016, 11:52 PM
  2. Replies: 2
    Last Post: 03-15-2014, 07:28 AM
  3. Replies: 10
    Last Post: 06-28-2012, 08:59 AM
  4. How to calculate sum of a moving range and average it
    By a_driga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-27-2011, 02:17 AM
  5. Moving average of the last 13 cells in a row
    By sacorndog in forum Excel General
    Replies: 2
    Last Post: 08-10-2010, 04:11 PM

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