+ Reply to Thread
Results 1 to 9 of 9

Running averages based on a DATE

  1. #1
    Registered User
    Join Date
    02-19-2021
    Location
    Wicklow
    MS-Off Ver
    O365
    Posts
    49

    Running averages based on a DATE

    Hi

    I wish to calculate a running average of one criteria against multiple other criteria - %WFH against different types of attendance at work). This is calculated in the red table in the attached example. The averages are Col S (%WFH 1 against certain attendances) and Col U % WFH 2 against all attendances. These records are averaging since 01.1.2022. I want to add a DATE criteria that only counts the running average up to TODAYs date (i.e. it is not counting attendances rostered into the future). I would also like to understand how to include a date criteria if I want to limit the average to a specific time period e.g. just a calendar month, a specified date range (e.g. 10 May 24 June)
    I hope my query is comprehensible and thank you in advance for any advice/assistance
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Running averages based on a DATE

    Do want a separate average in addition to the numbers you have now? Or do you want to modify the calculations in C, E, I, J rows 2-5 to include only up to today?

    The strategy is to use COUNTIFS to restrict the dates. For example, to count the number of occurrences of WFH for Emma (formula in C3) you would use

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    To use a different date range

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    where begindate and enddate are expressions that give dates, such as references to two cells.

    You would use the same strategy for all the counts you are calculating.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    02-19-2021
    Location
    Wicklow
    MS-Off Ver
    O365
    Posts
    49

    Re: Running averages based on a DATE

    Hi 6StringJazzer

    I don't want a separate average particularly, and I wouldn't modify the calculations in C,E,I and J. I want this average to run all the time based on WFH being the sum of the contents of Cells C,E, I and J for each row. I just don't want them to count anything in the future (as in events rostered after TODAY). If I look at an average today I want the average to be based only on events that have already happened.

    I will create a separate table using begindate and enddate, when I get my head around my first conudrum!

    I tried the first solution but I have made it work yet....

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Running averages based on a DATE

    If you don't want to modify C, E, I, J then you will have to change S from being a simple division to rebuilding all of the components of those two numbers using COUNTIFS. This makes for a big formula.

    For example S2 becomes:

    =COUNTIFS(Table22[John],C1,Table22[Date],"<="&TODAY()) + COUNTIFS(Table22[John],E1,Table22[Date],"<="&TODAY()) + COUNTIFS(Table22[John],I1,Table22[Date],"<="&TODAY()) + COUNTIFS(Table22[John],J1,Table22[Date],"<="&TODAY())/COUNTIFS(Table22[John],B1,Table22[Date],"<="&TODAY()) + COUNTIFS(Table22[John],D1,Table22[Date],"<="&TODAY()) + COUNTIFS(Table22[John],C1,Table22[Date],"<="&TODAY()) + COUNTIFS(Table22[John],E1,Table22[Date],"<="&TODAY()) + COUNTIFS(Table22[John],I1,Table22[Date],"<="&TODAY()) + COUNTIFS(Table22[John],J1,Table22[Date],"<="&TODAY())

  5. #5
    Registered User
    Join Date
    02-19-2021
    Location
    Wicklow
    MS-Off Ver
    O365
    Posts
    49

    Re: Running averages based on a DATE

    Well that very much looks like modifying C, E, I, J is the way to go. But what modifications??

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Running averages based on a DATE

    I showed that in post #2 as an example for column C. You would just do the same thing in the other columns.

  7. #7
    Registered User
    Join Date
    02-19-2021
    Location
    Wicklow
    MS-Off Ver
    O365
    Posts
    49

    Re: Running averages based on a DATE

    Hi there, thanks a million for the tutoring! I really understand this now. One strange thing when I did it on a trial sheet, it worked fine. But when I am populating it in a real sheet, the totals in the table are not adding up to the correct amount. E.g. say John in cell B2. When I select he total number of days leave for him to date, the number is 4 with 2 days due in June therefore totalling 6. But the cell is counting it as 23. Could I ask you to take a look and see where I have gone wrong? Please?
    Attached Files Attached Files

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Running averages based on a DATE

    The table is named differently in the two files. In the first file you attached, it was Table22. In the latest file you attached, it is Table7. With that change the result is 4 (the other 2 are in the future so are not included).

  9. #9
    Registered User
    Join Date
    02-19-2021
    Location
    Wicklow
    MS-Off Ver
    O365
    Posts
    49

    Re: Running averages based on a DATE

    Thank you so much for your help. I learnt a lot from you and always try to put into practice whatever the excel lords impart....

+ 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. Get player averages based on name and date
    By Milkman9691 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-25-2022, 04:40 AM
  2. [SOLVED] formula to work out annual averages based of the corresponding date in adjacent column??
    By lilybickel in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-04-2021, 06:15 AM
  3. Replies: 1
    Last Post: 02-02-2021, 06:09 AM
  4. [SOLVED] Getting Weekly Averages Based off of Date and Group
    By KoolKatelyn in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-17-2017, 02:42 PM
  5. Automating monthly budget averages based on start and end date
    By kjkotowski in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-31-2014, 09:10 AM
  6. Averages Based on Date
    By guilbj2 in forum Excel General
    Replies: 2
    Last Post: 09-13-2007, 12:40 PM
  7. [SOLVED] Trying to find averages based on date.
    By Daesthai in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2006, 02:10 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