+ Reply to Thread
Results 1 to 10 of 10

Staff Absence Calculations

  1. #1
    Registered User
    Join Date
    10-18-2019
    Location
    Milton Keynes
    MS-Off Ver
    2010
    Posts
    5

    Staff Absence Calculations

    Hi,

    I have found many helpful solution in this forum but I struggle with another thing and hope that somebody is able to find the way to resolve it.
    I need formula that will count the sickness occasions for the whole year(all information in one excel tab) and for the last six months (same data).
    Please find the fraction of my spreadsheet attached.
    0 - day off
    E - early shift
    L - late shift
    S - sick
    HDS - half day sick

    I have only filled in January and December with "S" and "HDS"

    I would highly appreciate your help.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Formula to Calculate Occurrences of Staff Absence

    Your dates are for 2020 - if you are keeping track, then the dates should really be started in 2019:

    For "S" for the last six months

    =COUNTIFS($1:$1,">="&EDATE(TODAY(),-6),$1:$1,"<="&TODAY(),3:3,"S")

    For the entire year 2019

    =COUNTIF(3:3,"S")

    You can do similar formulas for your other codes.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    10-18-2019
    Location
    Milton Keynes
    MS-Off Ver
    2010
    Posts
    5

    Re: Formula to Calculate Occurrences of Staff Absence

    Hi Bernie,

    Thank you for coming back to me so quick.
    Probably I didn't make myself clear enough but I want to count occasions of sickness not days i.e E E S 0 0 S L is only one occasion split by two rest days. Staff is sick on Friday then has two rest days and then continues being sick on Monday.
    As you can see Andy also has rest days on random days in the week.
    Would you be able to help?

  4. #4
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Staff Absence Calculations

    I have moved your posts to this new thread. Please see forum rule #4 regarding thread hijacking and why we don’t allow it. Thanks.
    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.

  5. #5
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Formula to Calculate Occurrences of Staff Absence

    Put the code below into a standard codemodule, and save the workbook as a macro-enabled .xlsm file.

    Then use the code like this to count S occurrences:

    =OccurCount(E3:NF3,"S")

    And like this to count S occurrences in the last six month.

    =OccurCountDate(E3:NF3,"S",$E$1:$NF$1,6)

    Again, note that your date headers should not be in 2020 until it is actually 2020


    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-18-2019
    Location
    Milton Keynes
    MS-Off Ver
    2010
    Posts
    5

    Re: Staff Absence Calculations

    Hi Bernie,

    I have followed your instructions but I constantly get an #Name? errorAttachment 690465

  7. #7
    Registered User
    Join Date
    10-18-2019
    Location
    Milton Keynes
    MS-Off Ver
    2010
    Posts
    5

    Re: Staff Absence Calculations

    Hi Bernie,

    I am coming back to you on the same topic long time after your last answer.
    I would really appreciate if you could have a look on the attached spreadsheet to find out why do I get the #name? error. This time I have attached the excel file instead of picture.
    Thank you so much for your help.

    Simon
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Staff Absence Calculations

    You did not follow my instructions: the first instruction was

    "Put the code below into a standard codemodule"

    You put the code into the worksheet's codemodule, where it does not belong. Change that and the code will be found and used as a worksheetfunction.

  9. #9
    Registered User
    Join Date
    10-18-2019
    Location
    Milton Keynes
    MS-Off Ver
    2010
    Posts
    5

    Re: Staff Absence Calculations

    Hi Bernie,

    Thank you so much for your help. I really appreciate it. Everything works perfectly.
    If you don't mind I have another question on this.

    How the VBA code would look like if the rest days would have been marked as "blank fields" instead of "0" on the spreadsheet?
    I've tried to play with the above code but couldn't figure it out by myself.
    Thank you.

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Staff Absence Calculations

    Just removing this should work:

    Please Login or Register  to view this content.

+ 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] Formula to Calculate Occurrences of Staff Absence
    By Steve Bowden-Jones in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 08-10-2020, 11:48 AM
  2. staff absence tracker inc rolling year
    By BIDD in forum Excel General
    Replies: 4
    Last Post: 09-16-2019, 02:58 PM
  3. [SOLVED] Count the number of staff working between times based on staff position
    By sparky1978 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-03-2016, 08:10 AM
  4. Big number of Staff - problem of replacement / absence
    By youssefoudra in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-26-2014, 10:44 AM
  5. [SOLVED] Macro to update Score Card Summary when the new staff add-in or existing staff deleted
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-12-2014, 02:43 PM
  6. Staff Planner - How To Set Up UserForm to Generate Data into Staff & Date Spreadsheet
    By Marie Snell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-19-2013, 11:04 PM
  7. [SOLVED] Staff Absence Record
    By Janeong in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-27-2012, 08:56 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