+ Reply to Thread
Results 1 to 6 of 6

Weekly average formula (outputs only on last data entry of Sunday)

  1. #1
    Registered User
    Join Date
    09-17-2013
    Location
    Evansville, USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Weekly average formula (outputs only on last data entry of Sunday)

    Please help!

    I have Column A (Date/time) which is always shown in 1/1/13 7:00:00 format. The only times are 7:00:00 and 19:00:00 (day and night shifts). Column B has the collected data during each shift and column C is the average for the data. Currently I have the average (col C) with an array function of =AVERAGE(IF(($A2-$A$2:$A2)<7,$B$2:$B2)). When filled down, every row has an average value from the previous 7 days. I only want to have the average taken on the last Sunday 7pm entry from the previous Monday's first 7 am entry. I also want to highlight these values in Column C. Can anyone help? I'm a little lost!

    I attached a copy of my worksheet. Column D is what I would like to have in the end and Column C is what I have so far.
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Weekly average formula (outputs only on last data entry of Sunday)

    Looks difficult. I'll take a swing at it.

    So far, identifying last Sunday record for the week:

    =IF(WEEKDAY(A2,1)=7,IF(WEEKDAY(A3,1)=1,999,""),"")

    This notates a 999 on the last day of the week. Now just to substitute the 999 with a suitable average formula.

  3. #3
    Registered User
    Join Date
    09-17-2013
    Location
    Evansville, USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Weekly average formula (outputs only on last data entry of Sunday)

    Sorry I'm kind of a noobie with Excel. Are you saying that I should use the average array function I have in Column C and put that in place of 999 in your formula? Thanks for helping!

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Weekly average formula (outputs only on last data entry of Sunday)

    That's right!

    The final result in D2 would be:

    =IF(WEEKDAY(A2,2)=7,IF(WEEKDAY(A3,2)=1,AVERAGE(IF(($A2-$A$2:$A2)<7,$B$2:$B2)),""),"")

    (Still entered as an array)

    Note, I changed the weekday function to (ref,2) for the Monday through Sunday layout.

  5. #5
    Registered User
    Join Date
    09-17-2013
    Location
    Evansville, USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Weekly average formula (outputs only on last data entry of Sunday)

    Wow! Thank you so much! This is amazing

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Weekly average formula (outputs only on last data entry of Sunday)

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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 Weekly Data
    By shmoowalker in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-04-2013, 02:05 PM
  2. continuosly average the last 7 columns add data weekly
    By jriley60 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2011, 04:02 AM
  3. Formula for weekly average & changing daily formula
    By sandbach in forum Excel General
    Replies: 2
    Last Post: 11-01-2010, 08:15 PM
  4. Get Weekly Report Start Sunday ?
    By phpmann in forum Excel General
    Replies: 0
    Last Post: 10-12-2008, 01:42 PM
  5. [SOLVED] Sunday to Saturday weekly foreward planner
    By leub in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-09-2006, 12:00 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