I am stuck on a problem where i want to find out the absent days for an employee where if he is not coming for 3 consecutive days it should add the 3 days in a new column (it might for for multiple days) the problem is start date and end date is there so i want to match if the employee is same, start date of the next absence is consecutive day it should add it , i am attaching the screenshot and table index here . Any help from Excel or R will be helpful. I have already tried Max if
and Sumif
. Only problem is I only want addition if he/she is absent for the consecutive days
ID START_DATE END_DATE ABSENCE_DAYS
3 14-06-18 14-06-18 1
3 17-06-18 17-06-18 1
3 18-06-18 18-06-18 1
4 01-06-18 01-06-18 1
4 04-06-18 04-06-18 1
4 21-06-18 22-06-18 2
4 27-06-18 27-06-18 1
4 28-06-18 28-06-18 1
4 04-07-18 04-07-18 1
4 05-07-18 05-07-18 1
4 09-07-18 09-07-18 1
4 11-07-18 11-07-18 1
4 23-07-18 23-07-18 1
4 24-07-18 24-07-18 1
4 25-07-18 25-07-18 1
5 07-06-18 08-06-18 2
5 28-06-18 28-06-18 1
5 27-07-18 27-07-18 0.5
6 10-06-18 11-06-18 2
6 17-06-18 21-06-18 5
6 24-06-18 25-06-18 2
6 26-06-18 03-07-18 6
6 15-07-18 15-07-18 1
6 22-07-18 22-07-18 1
For Example Employee 4 has taken 3 consecutive leaves on 23,24 and 25th so in a new column where it says he was absent for 3 consecutive days.
updated
Desired output would look something like this , this is just a sample