+ Reply to Thread
Results 1 to 8 of 8

Calculating number of occurrences in the last 12 months (weekdays only)

  1. #1
    Registered User
    Join Date
    02-18-2021
    Location
    England
    MS-Off Ver
    365
    Posts
    8

    Calculating number of occurrences in the last 12 months (weekdays only)

    Hi all

    I am very new to Forums and require some help please. I have an absence tracker that I need to calculate the number of occurrences an employee has been sick in the last 12 months.

    I have a column that has dates in including weekend and next to that is columns of employee names.

    If an employee is is off, then I would complete "Sick" on the correct employee and the correct corresponding date.

    I need a formula that calculates the number occasions in the last 12 months and employee has been sick (not days...just occasions) - It's been driving me crazy!

    For example, if an employee was sick in March 2020 (2 days), May 2020 (5 days) and September 2020 (3 days). This would be 10 days sick in 12 months (3 occasions in 12 months).

    I need the formula to group continuous days if 1 period of absence runs into another week but to ignore the weekends within that period. I have attached a sample version of it.

    Any help you can give me will be appreciated!!!

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Calculating number of occurrences in the last 12 months (weekdays only)

    there will be a few options here, one:

    =1+SUMPRODUCT(SIGN(NETWORKDAYS(AGGREGATE(15,6,$A$2:$A$735/(B$2:B$735="Sick"),SEQUENCE($H2-1,,1)),AGGREGATE(15,6,$A$2:$A$735/(B$2:B$735="Sick"),SEQUENCE($H2-1,,2)))-2))
    copied to right

    would return 3, and 4 for EE 1 & 2 respectively

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Calculating number of occurrences in the last 12 months (weekdays only)

    @VB17 -- ignore the above, couple of typos (e.g. $H2 rather than H$2), apologies - and would have ignored the last 12 month requirement:

    H3: =1+SUMPRODUCT(SIGN(NETWORKDAYS(AGGREGATE(14,6,$A$2:$A$735/(C$2:C$735="Sick"),SEQUENCE(H$2-1,,H$2,-1)),AGGREGATE(14,6,$A$2:$A$735/(C$2:C$735="Sick"),SEQUENCE(H$2-1,,H$2-1,-1)))-2))
    copied to I3

    the above would return 3, and 5 ... rather than 3, and 4 -- you might need to explain why you think there are 4 discrete sequences rather than 5, for Ee 2.
    (11-19 May, 15-19 Jun, 29-Jun to 10-Jul, 14-18 Sep and 3-13 Nov.)

  4. #4
    Registered User
    Join Date
    02-18-2021
    Location
    England
    MS-Off Ver
    365
    Posts
    8

    Re: Calculating number of occurrences in the last 12 months (weekdays only)

    Hi XLent

    Thank you for taking the time to do this. I am getting an error message in the cell using your new formula.

    EE2 should be 5 occurrences (sorry, typo on my part)

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Calculating number of occurrences in the last 12 months (weekdays only)

    In H3 copied to H4
    Please Login or Register  to view this content.
    To enter ARRAY formula
    Copy and paste the formula in cell
    Press F2
    Press Ctrl+Shift+Enter together
    Excel covers the formula with {}.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  6. #6
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: Calculating number of occurrences in the last 12 months (weekdays only)

    Quote Originally Posted by VB17 View Post
    Hi XLent; Thank you for taking the time to do this. I am getting an error message in the cell using your new formula.
    Yet another typo on my part, I'm afraid!

    H3: =1+SUMPRODUCT(SIGN(NETWORKDAYS(AGGREGATE(14,6,$A$2:$A$735/(B$2:B$735="Sick"),SEQUENCE(H$2-1,,H$2,-1)),AGGREGATE(14,6,$A$2:$A$735/(B$2:B$735="Sick"),SEQUENCE(H$2-1,,H$2-1,-1)))-2))
    copied to right

  7. #7
    Registered User
    Join Date
    02-18-2021
    Location
    England
    MS-Off Ver
    365
    Posts
    8

    Re: Calculating number of occurrences in the last 12 months (weekdays only)

    Thank you XLent and kvsrinivasamurthy - this has worked a treat. Much appreciated

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,556

    Re: Calculating number of occurrences in the last 12 months (weekdays only)

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

+ 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] Calculating the number of months since a date
    By mellowdude in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 11-06-2018, 10:30 AM
  2. [SOLVED] calculating months based on specified number of days
    By amartin575 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-25-2016, 10:47 AM
  3. Calculate number of occurrences of text in the past 12 months
    By wildbilll in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-01-2015, 03:47 PM
  4. [SOLVED] Calculating Number of Months between two given dates
    By InterstateRentals in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-09-2013, 10:15 AM
  5. calculating number of months in excel
    By Danny90601 in forum Excel General
    Replies: 5
    Last Post: 10-24-2012, 04:53 AM
  6. [SOLVED] What is the formula for calculating the number of months passed?
    By Teri in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-08-2006, 10:10 PM
  7. calculating number of months from today
    By JNW in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-15-2005, 05:05 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