date formula to determine amount of vacation weeks

bh24524

Active Member
Joined
Dec 11, 2008
Messages
319
Office Version
  1. 2021
  2. 2007
I am looking for help on a formula that will look up a given seniority date contained in cell C11. The formula would be in D11. I want it to determine the number of vacation weeks a warehouse employee gets based on their hire date and length of time with the company. They get vacations based on the following schedule:

1 year = 1 week
3 years = 2 weeks
8 years = 3 weeks
14 years = 4 weeks
*20 years = 5 weeks
*25 years = 6 weeks

*All employees hired after June 5, 2016 cap at 4 weeks. Can this somehow be incorporated into the formula?
 
Which version of excel do you need this to work with?

I notice that you have 2 versions shown on your profile, neither of which I have been able to get this working with yet.
I have a formula that looks like it works (not tested much yet), but it uses the LET and UNIQUE functions which are only available in the most recent updates of office 365. Looking at the complexity of that formula I think that older versions are going to be extremely difficult to make this work with, something as far back as 2007 might even be impossible.
Excel Formula:
=LET(x,DATE(YEAR(TODAY()),MONTH(C11),DAY(C11)),y,LOOKUP(DATEDIF(C11,x+{-1,1},"Y"),{0,1,3,8,14,20,25},{0,1,2,3,4,5,6}),z,y&IF(COUNT(UNIQUE(y))=2,{"","*"},""),INDEX(z,1+(TODAY()<x)))
and that is without the 4 week cap on more recent hires.
So at work, we have Excel 2013. that's what I'm using this for. They are also talking of upgrading our Office version but I don't know to what. My guess would be 2016 but I am not certain as of yet. That should be coming within the next 2 months rumor has it.
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
With that in mind I'll work on using 2013, I can't think of any additional features in 2016 that would help with this.
I've asked (or perhaps challenged would be more accurate) another member to take a look at it as well, hopefully we can come up with a solution between us.
 
Upvote 0
... So one employee for example on these charts may have had a 2 in his vacations for last year on the chart and that would have been correct as that was all he had at that point. This year though since he will be earning a 3rd week say in October, the chart would show a "3" with an asterisk in column E and this basically designates that in total for the year, he will have 3 weeks of vacation but the asterisk flags them that not all 3 weeks are currently available...
See if the following formulas (based on jasonb75's Post #4) work for you:
Cell D11
Excel Formula:
=LOOKUP(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y"),{0,1,3,8,14,20,25},IF(C11>DATE(2016,6,5),{0,1,2,3,4,4,4},{0,1,2,3,4,5,6}))
Cell E11
Excel Formula:
=IF(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y")>DATEDIF(C11,TODAY(),"Y"),"*","")
 
Upvote 0
With that in mind I'll work on using 2013, I can't think of any additional features in 2016 that would help with this.
I've asked (or perhaps challenged would be more accurate) another member to take a look at it as well, hopefully we can come up with a solution between us.

See if the following formulas (based on jasonb75's Post #4) work for you:
Cell D11
Excel Formula:
=LOOKUP(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y"),{0,1,3,8,14,20,25},IF(C11>DATE(2016,6,5),{0,1,2,3,4,4,4},{0,1,2,3,4,5,6}))
Cell E11
Excel Formula:
=IF(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y")>DATEDIF(C11,TODAY(),"Y"),"*","")
Thank you both. I will test these tomorrow at work when I have the file in front of me. Keep you posted...
 
Upvote 0
@Tetra201 Thanks for your help in resolving this one, I haven't evaluated it in excel but it looks like it should do what was asked for.

Think my downfall was trying to fit it all into a single formula.
 
Upvote 0
See if the following formulas (based on jasonb75's Post #4) work for you:
Cell D11
Excel Formula:
=LOOKUP(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y"),{0,1,3,8,14,20,25},IF(C11>DATE(2016,6,5),{0,1,2,3,4,4,4},{0,1,2,3,4,5,6}))
Cell E11
Excel Formula:
=IF(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y")>DATEDIF(C11,TODAY(),"Y"),"*","")
Alright so I tested it and both formulas actually not functioning as intended. I changed the shift codes to see several people and how it was treating them and here is what I'm seeing:

1611231743553.png


For this particular shot, it is only giving a maximum of 4 weeks but those particular employees were hired before June 5, 2016 so they would actually be entitled to 6 weeks. Also the asterisk is showing for all of the employees even the ones with two weeks and actually shouldn't because this current year was not a year that they earned an additional week of vacation.

In this next shot, this IS functioning correct, several of them will earn one week of vacation and there is an asterisk showing because we haven't come to the anniversary yet in the year:

1611232393462.png


Sorry for how annoying these nuances are in this scenario. Gotta love CBA's with the Unions...:rolleyes:
 
Upvote 0
On the "only giving a maximum of 4 weeks" issue: it looks like your dates are text strings, not numbers (you can test this via =ISNUMBER(C11)).
Here is a slightly modified formula that should take care of this:
Excel Formula:
=LOOKUP(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y"),{0,1,3,8,14,20,25},IF(C11-DATE(2016,6,5)>0,{0,1,2,3,4,4,4},{0,1,2,3,4,5,6}))
On the asterisk issue: I will take a look at it later today.
 
Upvote 0
On the "only giving a maximum of 4 weeks" issue: it looks like your dates are text strings, not numbers (you can test this via =ISNUMBER(C11)).
Here is a slightly modified formula that should take care of this:
Excel Formula:
=LOOKUP(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y"),{0,1,3,8,14,20,25},IF(C11-DATE(2016,6,5)>0,{0,1,2,3,4,4,4},{0,1,2,3,4,5,6}))
On the asterisk issue: I will take a look at it later today.
Thanks. That fixed the 4 week issue. I shifted departments again and found that it is also showing correctly if someone is accruing a 3rd week of vacation at a later date this year, so it seems that is fixed as well. Thanks for that!
 
Upvote 0
On the asterisk issue: my original formula for column E did miss an important component. See if the following updated formula works as required:
Excel Formula:
=IF(AND(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y")>DATEDIF(C11,TODAY(),"Y"),OR(DATEDIF(C11,DATE(YEAR(TODAY()),12,31),"Y")=IF(C11-DATE(2016,6,5)>0,{1,3,8,14},{1,3,8,14,20,25}))),"*","")
 
Upvote 0
@Tetra201 I apologise for dumping my partially answered question on you, I was getting nowhere with practical ideas for the second part of the question and needed some fresh eyes to see through the trees and find the forest. I was going to take another look at the thread but thought better to step back rather than confuse things with 2 sets of answers running parallel.

Thanks for your support :)
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,538
Members
449,038
Latest member
Guest1337

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