+ Reply to Thread
Results 1 to 8 of 8

get average by date

  1. #1
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    get average by date

    I've attached part of a very large worksheet (over 100,000 rows) in which column A are timestamps which have been converted from unix. The increments are very small, so in cases, it appears that row x is the same time as row x +1

    I would like to get the average of column B for all "identical" times, then once I have this, get the average of column B for all times during every calendar day.

    There is no strict pattern of the timestamps (that I can determine). But I'd like to come up with a method of giving equal weight to each minute of the day, and then in another column, get the average value for every 24 hour period.

    I don't have a formula in mind for this "normalization" nor do I think I can manage the vlookup formula which I assume is required.

    Any suggestions?

    Thanks so much!
    Attached Files Attached Files

  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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,417

    Re: get average by date

    Please add expected outcomes to the sample workbook (manually).
    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
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: get average by date

    I've attached a new file which shows an example of the manually calculated values I want to arrive at. I created several helper columns.

    Column C gets the average of any values in column B which have the same timestamp in Column A.

    Then in Column D I break a calendar day into 15 minute segments, then average these segments to obtain a daily value (column E).

    I know that this project could be solved in other ways or with different granularity, but the main concern is that I do not want to wind up with a daily
    value which uses 0's for time slots which have no value in column B. In other words, if there is no data for a particular minute, this does not mean that
    we must assume that minute's value = 0.

    (I believe that the average function does this automatically, by only averaging cells with values in a range)

    Thanks!
    Attached Files Attached Files

  4. #4
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: get average by date

    Your desired results are incorrect. You are taking an average of an average (with unequal sizes).

    The following formulas will produce the averages on the first instance of each desired value (instead of the last instance like in your sample):

    C2 =IF(COUNTIF(A$2:A2,A2)=1,AVERAGEIF(A:A,A2,B:B),"")

    E2 =IF(COUNTIF(A$2:A2,">="&INT(A2))=1,AVERAGEIFS(B:B,A:A,">="&INT(A2),A:A,"<"&INT(A2)+1),"")

    Still working on column D.

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: get average by date

    These produce the results in the desired cells:

    C2 =IF(COUNTIF(A$2:A2,A2)=COUNTIF(A:A,A2),AVERAGEIF(A:A,A2,B:B),"")

    D2 =IF(COUNTIFS(A$2:A2,">="&FLOOR(A2,"00:15"),A$2:A2,"<="&CEILING(A2,"00:15"))=COUNTIFS(A:A,">="&FLOOR(A2,"00:15"),A:A,"<"&CEILING(A2,"00:15")),AVERAGEIFS(B:B,A:A,">="&FLOOR(A2,"00:15"),A:A,"<"&CEILING(A2,"00:15")),"")

    E2 =IF(COUNTIF(A$2:A2,">="&INT(A2))=COUNTIFS(A:A,">="&INT(A2),A:A,"<"&INT(A2)+1),AVERAGEIFS(B:B,A:A,">="&INT(A2),A:A,"<"&INT(A2)+1),"")
    Last edited by 63falcondude; 11-11-2017 at 12:38 PM. Reason: Added D2 formula

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: get average by date

    Hey jr,

    I'm thinking a Pivot Table where you can group by Date and Time AND do an Average might do what you need?? No formulas needed See the attached for the example.

    Pivot Table Group by Minute Average.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  7. #7
    Forum Contributor
    Join Date
    12-03-2008
    Location
    Key West, FL
    MS-Off Ver
    365 Apps for Enterprise
    Posts
    665

    Re: get average by date

    Thanks Marvin and Falcondude, I appreciate your help on this!

  8. #8
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: get average by date

    Glad we could help. Thanks for the rep!

+ 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. [SOLVED] Merge All of Dates as one Date and Take Average of the Values of the Date
    By gozparlak in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-22-2017, 03:00 AM
  2. [SOLVED] Sumproduct formula, add up by date, average by date
    By 3smees23 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 03-08-2017, 05:00 PM
  3. Month to Date and Quarter to Date Average from Daily data
    By asvanthi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-15-2014, 07:10 AM
  4. [SOLVED] Need average of days for date values from date to current day that updates current date
    By FinGhost in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-12-2013, 04:41 PM
  5. Date and row average
    By cnunley in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-15-2013, 11:58 AM
  6. Compare average before a date to the average after the date
    By stephanbrown in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-08-2012, 05:10 PM
  7. [SOLVED] Formula to find a date range and date average
    By 1Monkey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-14-2012, 11:51 AM

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