0

First - an apology for the convoluted request. I know what I am trying to do but I'm not sure I can articulate it clearly enough.

I was a list of staff's absences with start date and end date. I need to work out how many days of a specific reporting week they were absent for, then I need to multiply that by the number of hours they work in a day.

Examples below :

Reporting week dates
Start date 30/09/2019 End Date 06/10/2019

Absences

Start date End date

16/05/2019 20/10/2019
21/05/2019
23/05/2019
25/06/2019 13/10/2019
06/08/2019 08/01/2020
06/08/2019 08/01/2020
12/08/2019 04/10/2019

I can see that for the majority of these it would be 7 days, but since there is a 5/7 pattern, it would be 5 days. But for the last one who came back halfway through the week it wouldn't be. But I'm not sure what the correct syntax would be on excel to achieve this consistently for every absence instances.

Any help would be very much appreciated!

Thank you

Lucy

1 Answer 1

0

Generally speaking, you can calculate the number of working days between two dates using the NETWORKDAYS function. This takes three arguments:

  1. Start date
  2. End date
  3. Holidays (an optional range of public holidays which are subtracted from the calculation)

So, in a simple calculation of total working days absent between start date and end date for your rows, and assuming you are using standard UK public holidays (I assume from your date format, but you can use any list of holidays):

=NETWORKDAYS(A2,IF(B2="",TODAY(),B2),$I$2:$I$8) 

Here I've said calculate the working days between the start date and end date, or if the end date is blank, between the start date and today.

enter image description here

In reference to your actual question, I think you want to calculate the number of absent days within a particular reporting week. So, you actually want to calculate the difference between the maximum of {the week start date and the absence start date} and the minimum of {the week end date and the absence end date}, using the holidays as specified above.

So, I put each reporting week as a different column next to each row, then used this formula, where the holidays are in column I as before.

=IF(NETWORKDAYS(MAX($A14,C$13),MIN($B14,C$13+6),$I$2:$I$8)<0,0,NETWORKDAYS(MAX($A14,C$13),MIN($B14,C$13+6),$I$2:$I$8)) 

You can see that in weeks where there was a bank holiday but the person was absent all week, it only counts 4 days absent since the bank holiday is "standard". If you don't want to consider bank holidays in the calculation, just remove the third parameter from the NETWORKDAYS function.

enter image description here

Since this formula will eventually return a negative in weeks after the absence has ended, I've used IF to say if the net working days is negative, then just return 0.

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.