Next Leave date

sachin99

New Member
Joined
Jun 18, 2013
Messages
15
Good Day Everyone,

I need a formula to get the next Leave date of an employee based on criteria.

1. Below is the table which shows date on which particular employee is on leave
2. Will enter date in other sheet in cell A2
3. we will also have employee name in this sheet
3. Cell next to employee name should give the next PL date for that employee depending on the date enter in the
Eg. 1. If Sachin is the employee and date enter in Celll A2 is 07-Jan-2018 then value in cell next to Sachin will be 10-Jan-2018

2. If Vikas is the employee and date enter in Celll A2 is 09-Jan-2018 then value in cell next to Sachin will be 12-Jan-2018

3. if the A2 cell is blank then today's date will be consider for calculation

Do let me know if you need any more information on my requirement.

DateSachinVikas
01-Jan-2018--
02-Jan-2018PL-
03-Jan-2018PL
04-Jan-2018
05-Jan-2018PL
06-Jan-2018PL
07-Jan-2018PL
08-Jan-2018PL
09-Jan-2018
10-Jan-2018PL
11-Jan-2018PL
12-Jan-2018PLPL

<tbody>
</tbody>

Regards
Sachin


<colgroup><col><col><col></colgroup><tbody>
</tbody>
 
output Sample 1

if i updated date as 01-Jan-2018 then below will be the output
Date
Name
Next PL Date
Count of PL
01-Jan-2018
Vikas
02-01-2018
2
01-Jan-2018
Sachin
05-01-2018
2
01-Jan-2018
Sunil
01-01-2018
1
01-Jan-2018
Umesh
05-01-2018
3

<tbody>
</tbody>

Umesh only has 2 PL's in the calendar table in total, where does the expected result of 3 come from?

For each sample repost the calendar table and highlight (different colour font) which PL's are getting counted for each person.
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Re: Next Leave date
Hi ,

Below is the sample data.

scenario 1:

below is calendar table for scenario 1


DateVikasSachinSunilUmesh
01-Jan-2018
02-Jan-2018PL
03-Jan-2018PLPL
04-Jan-2018
05-Jan-2018PL
06-Jan-2018PL
07-Jan-2018
08-Jan-2018
09-Jan-2018PLPL
10-Jan-2018PLPL
11-Jan-2018PLPLPLPL
12-Jan-2018PLPLPL
13-Jan-2018

<tbody>
</tbody>




output Sample 1

if i updated date as 01-Jan-2018 then below will be the output (PL consider are highlighted in bold and Blue)

DateNameNext PL DateCount of PL
01-Jan-2018Vikas02-01-20182
01-Jan-2018Sachin05-01-20182
01-Jan-2018Sunil03-01-20181
01-Jan-2018Umesh11-01-20182

<tbody>
</tbody>



Scenario 2 :

below is calendar table for 2nd example


DateVikasSachinSunilUmesh
01-Jan-2018
02-Jan-2018PL
03-Jan-2018PLPL
04-Jan-2018
05-Jan-2018PL
06-Jan-2018PL
07-Jan-2018
08-Jan-2018
09-Jan-2018PLPL
10-Jan-2018PLPL
11-Jan-2018PLPLPLPL
12-Jan-2018PLPLPL
13-Jan-2018

<tbody>
</tbody>





Output sample 2

if i updated date as 08-Jan-2018 then below will be the output (PL consider are highlighted in bold and Red)

DateNameNext PL DateCount of PL
08-Jan-2018Vikas09-01-20183
08-Jan-2018Sachin11-01-20182
08-Jan-2018Sunil09-01-20184
08-Jan-2018Umesh11-01-20182

<tbody>
</tbody>



Do let me know if you have any query.

Regards
Sachin
 
Upvote 0
Hi, I see that you have completely changed your expected results for "Output Sample 2" - And the formula in post 14 gives those expected results.

You need to find a way to describe what you want to count and why or provide some sample data that clearly demonstrates it.

Can you understand why this is confusing?
 
Upvote 0
Hi

Yes, i have change the data but used the same data for both the examples with color coding which show which PL are consider for counting.


Thanks!!

Regards
 
Upvote 0
Here is my suggestion.


Excel 2013/2016
ABCDE
1DateEmployeeNext PLNext BlankCount Of PL
201/01/2018Vikas02/01/201804/01/20182
301/01/2018Sachin05/01/201807/01/20182
401/01/2018Sunil03/01/201804/01/20181
501/01/2018Umesh11/01/201813/01/20182
608/01/2018Vikas09/01/201812/01/20183
708/01/2018Sachin11/01/201813/01/20182
808/01/2018Sunil09/01/201813/01/20184
908/01/2018Umesh11/01/201813/01/20182
Sheet2
Cell Formulas
RangeFormula
C2=INDEX(Sheet1!$A$2:$A$100,MATCH(1,INDEX((Sheet1!$A$2:$A$100>=A2)*(INDEX(Sheet1!$B$2:$E$100,0,MATCH(B2,Sheet1!$B$1:$E$1,0))="PL"),0),0))
D2=INDEX(Sheet1!$A$2:$A$100,MATCH(1,INDEX((Sheet1!$A$2:$A$100>=C2)*(INDEX(Sheet1!$B$2:$E$100,0,MATCH(B2,Sheet1!$B$1:$E$1,0))=""),0),0))
E2=MATCH(D2,Sheet1!$A$2:$A$16,0)-MATCH(C2,Sheet1!$A$2:$A$16,0)



Excel 2013/2016
ABCDE
1DateVikasSachinSunilUmesh
201/01/2018
302/01/2018PL
403/01/2018PLPL
504/01/2018
605/01/2018PL
706/01/2018PL
807/01/2018
908/01/2018
1009/01/2018PLPL
1110/01/2018PLPL
1211/01/2018PLPLPLPL
1312/01/2018PLPLPL
1413/01/2018
Sheet1
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,743
Members
449,094
Latest member
dsharae57

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