Found Dates between Gaps

vishal0589

Board Regular
Joined
May 13, 2014
Messages
63
Hi Friends,
I am working with a attendance register where I have to check gap between two subsequent Weekly Offs (W/O) with following conditions.
-> There must be 4 Present (P) between two Weekly Offs (W/O).
-> If Minimum 4 present (P) is not available between two Weekly Offs (W/O), dates of W/O will be resulted in columns

for example.

S. No.Emp. No.12345678910111213Output
1143PPPPW/OPPW/OPPPPW/O58
2499PW/OPPPPW/OPPPELELW/O713
3501PPPPCLPPPPW/OPPP
4505PW/OPPPPW/OCLPPPW/OP712
5
506PPCLPPW/OPELPPW/OPP611
6
509PW/OP
PPPW/OPPPPCLP
7758
PW/OPCLCLPW/OPPCLPW/OP2712

<colgroup><col span="2"><col><col span="17"></colgroup><tbody>
</tbody>

<colgroup><col span="2"><col><col><col span="18"></colgroup><tbody>
</tbody>



Please help me out.

Thanks in Advance.

CMA Vishal Srivastava
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
b ecause I am not clear what is wanted - surely "holiday" is taken when the employee wants it - not when you say......
 
Upvote 0
Hi,
What I want to assign W/O to employees for regulatory purpose and attendance is also for imaginary figures.

As stated in previous example, Suppose we have 30 days attendance cycle and we have assigned Presents (P), EL, CL, H ,etc to every employee on random basis.

But as far as W/O is concerned we want to assign W/O only when Employee have completed at least 4 P (Presents).

You can override existing values with W/O.
 
Upvote 0
at least 4 is 4 or 5 or 6 or 7 or 8..........

so what is the rule for assigning W/O

we could have a column on the right of the data saying how many W/O's an employee has POTENTIALLY

eg he could earn 3 because he has 14 p's yet has not yet had a W/O
 
Upvote 0
1) There must be minimum 4 Presents (P) between two Weekly Offs (W/O)

2) 3-4 Weekly Offs (W/O) could be assigned in a 30 days period.

e.g:
We have assigned following attendance:
Code:
[TABLE="width: 1989"]
<colgroup><col><col><col span="29"></colgroup><tbody>[TR]
[TD]Emp. No.[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]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]W/O[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]CL[/TD]
[TD]P[/TD]
[TD]W/O[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]EL[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]W/O[/TD]
[TD]P[/TD]
[/TR]
[TR]
[TD]501[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]W/O[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]W/O[/TD]
[TD]P[/TD]
[TD]H[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]W/O[/TD]
[TD]H[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]P[/TD]
[TD]H[/TD]
[TD]P[/TD]
[TD]W/O[/TD]
[TD]P[/TD]
[/TR]
</tbody>[/TABLE]


Provided W/O replaces Presents (P) only.


Hope you understand.
 
Upvote 0
It is a regulatory requirement. In 30 days period 3-4 Weekly off (W/O) should be given to each employee.

Weekly offs (W/O) could be from any day in 30 days period
 
Last edited:
Upvote 0
S. No.Emp. No.123456789101112131415161718192021222324252627282930W/O total<3>4
1143PPPPW/OPPPPPPW/OPPPPPPW/OPPPPPPPPPPP3
2499PPPPPW/OPPPPPPW/OPPPPPPW/OPPPPPPPPPP3
3501PPPPCLPW/OPPPPPPW/OPPPPPPW/OPPPPPPPPP3
4505PPPPPPPW/OPPPPPPW/OPPPPPPW/OPPPPPPPP3
5506PPCLPPPPPW/OPPPPPPW/OPPPPPPW/OPPPPPPP3
6509PPPPPPPPPW/OPPPPPPW/OPPPPPPW/OPPPPPP3
7758PPPCLCLPPPPPW/OPPPPPPW/OPPPPPPPPPPPP2YES
20
ERROR
each person must have 3 or 4 W/O's
7 persons
=21 to 28 W/O's
THIS RANDOM PATTERN OF ASSIGNMENT
SHOWS Emp 758 needs one more w/o
then compliance is achieved
the last 2 columns show if number of W/O
is outside requirements
the total 20 shows that at least one more W/O is due

<colgroup><col><col><col><col span="2"><col><col><col><col><col><col><col><col><col><col span="2"><col><col span="2"><col><col><col><col span="2"><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
I was putting forward an idea - a pattern whose shape is dependent on the number of employees - blocks of 5 employees come to mind - and more about 3 or 4 - why cannot it be 3 one month and 4 the next month - with excel you have to define rules....
 
Upvote 0

Forum statistics

Threads
1,215,475
Messages
6,125,028
Members
449,205
Latest member
Eggy66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top