Formula or other to determine amount of vacation weeks

bh24524

Active Member
Joined
Dec 11, 2008
Messages
321
Office Version
  1. 2021
  2. 2007
Hello, so I am looking to see if a formula or other could assign an asterisk to when someone will be due a new vacation in the year based on how long they have been with the company. There are several conditions though, if they are Union employees or non-union, and in the case of Union depending on if they were hired after a certain year. I will explain those below the schedule of when employees actually earn their vacation.

How many years from hire date (UNION)
1 year = 1 week of vacation
3 years = 2 weeks vacation
8 years = 3 weeks vacation
14 years = 4 Weeks vacation
20 years = 5 weeks vacation
25 years = 6 weeks vacation

Here are the special conditions mentioned above for Union employees:

If they were hired before 2002, they can get up to 6 weeks
If they were hired on or after 2002 but before 2016, they can get up to 5 weeks
If they were hired in 2016 or after, they can only get up to 4 weeks

Here is the schedule of vacations for Non-Union employees

6 months = 1 week vacation
1 year = 2 weeks vacation
5 years = 3 weeks vacation however, they do not get this extra week until January 1st of what would be their 6th year
14 years = 4 weeks vacation however, they do not get this extra week until January 1st of what would be their 15th year
19 years = 5 weeks vacation however, they do not get this extra week until January 1st of what would be their 20th year

So in our vacation software which is unfortunately very out of date, the way it works is it does calculate those amount of weeks due as mentioned. We run a report which will generate charts by department that has their total amount of weeks they are entitled to and a blank box next to it where the asterisk mentioned above will go. However, the way it is programmed it will only give an asterisk in that separate box to those who are to get ONE week in that year. It does not work for any of the years after that.

So that is where maybe a formula could come in I hope. Bear in mind, Union charts are separated from Non-union charts so it may end up that I would have 2 formulas. The number of weeks they earn starts in D11 and goes down from there by how many employees are on that chart. The asterisk would start in D12 and go down from there depending on how many employees are on that chart. So based on the information and criteria I have given above, is there some formula or other I can utilize in the excel charts that are generated that will put the asterisk in the cells if they are getting an additional week that year?
 
Last edited:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
How many years from hire date (UNION)
1 year = 1 week of vacationunionyrsvac
3 years = 2 weeks vacation00
8 years = 3 weeks vacation21
14 years = 4 Weeks vacation21
20 years = 5 weeks vacation21
25 years = 6 weeks vacation21
35
Here are the special conditions mentioned above for Union employees:176
996
If they were hired before 2002, they can get up to 6 weeks
If they were hired on or after 2002 but before 2016, they can get up to 5 weeks
If they were hired in 2016 or after, they can only get up to 4 weeksnonunionyrsvac
00
Here is the schedule of vacations for Non-Union employees0.51
11
6 months = 1 week vacation53
1 year = 2 weeks vacation144
5 years = 3 weeks vacation however, they do not get this extra week until January 1st of what would be their 6th year195
14 years = 4 weeks vacation however, they do not get this extra week until January 1st of what would be their 15th year995
19 years = 5 weeks vacation however, they do not get this extra week until January 1st of what would be their 20th year
JOINEDSERVICEUNIONMAXNONUMAXvacallowance
name1U199028656####with 2 tables defining allowances
name2NONU199028655
name3U199424556formula in #####
name4NONU199424555
name5U199820556=IF(C24="U",VLOOKUP(E24,uniontable,2),VLOOKUP(E24,nonuniontable,2))
name6NONU199820555
name7U200018446
name8NONU200018444you can adjust the values in the lookup tables
name9U200315445
name10NONU200315444
name11U200513435
name12NONU200513433
name13U20099435
name14NONU20099433
name15U20117335
name16NONU20117333
name17U20144335
name18NONU20144331
name19U20162231
name20NONU20162231
name21U20171120
name22NONU20171121
name23U20180000
name24NONU20180000

<colgroup><col span="5"><col><col><col><col span="3"><col><col span="2"><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
There is a hidden function within Excel called DATEDIF that could be perfect for this. I say "hidden" because you won't find it in Excel help, but you can use it like a normal function.

If column A has type ("Union" or "Non-Union") and column B has start dates (Excel dates, not just years), try this in C2:

Code:
=IF(A2="Union",MIN(VLOOKUP(DATEDIF(B2,TODAY(),"y"),{1,1;3,2;8,3;14,4;20,5;25,6},2),CHOOSE(MATCH(YEAR(B2),{1900,2002,2016}),6,5,4)),VLOOKUP(DATEDIF(B2,DATE(YEAR(TODAY()),1,1),"m"),{6,1;12,2;60,3;168,4;228,5},2))

Here, DATEDIF(B2,TODAY(),"y") will return the integer value of full years between the start date and today. Similarly, DATEDIF(B2,DATE(YEAR(TODAY()),1,1),"m") will return the integer value of full months between the start date and Jan 1 of the current year.

I'd recommend putting the two arrays in tables on a different sheet instead of listing them within the { }s of the formula above, but this illustrates that you actually *can* do this calculation within one formula if you wanted to.
 
Upvote 0
There is a hidden function within Excel called DATEDIF that could be perfect for this. I say "hidden" because you won't find it in Excel help, but you can use it like a normal function.

If column A has type ("Union" or "Non-Union") and column B has start dates (Excel dates, not just years), try this in C2:

Code:
=IF(A2="Union",MIN(VLOOKUP(DATEDIF(B2,TODAY(),"y"),{1,1;3,2;8,3;14,4;20,5;25,6},2),CHOOSE(MATCH(YEAR(B2),{1900,2002,2016}),6,5,4)),VLOOKUP(DATEDIF(B2,DATE(YEAR(TODAY()),1,1),"m"),{6,1;12,2;60,3;168,4;228,5},2))

Here, DATEDIF(B2,TODAY(),"y") will return the integer value of full years between the start date and today. Similarly, DATEDIF(B2,DATE(YEAR(TODAY()),1,1),"m") will return the integer value of full months between the start date and Jan 1 of the current year.

I'd recommend putting the two arrays in tables on a different sheet instead of listing them within the { }s of the formula above, but this illustrates that you actually *can* do this calculation within one formula if you wanted to.

To be honest, I don't know that either of these solutions would work. Let me clarify further, there are many departments which cause the excel charts to be generated. There are many charts from the union and there are many different ones from the non-union. These charts get sent down for employees to put X's in the dates across the boxes. I'm really just looking for a function for the asterisk that I mentioned, one that I can just copy to all those charts. I know that seems tedious but it will actually save a lot more time than me just looking at every person on every chart to determine if they are getting a vacation that year. Is there perhaps a different solution? As I said if we need one formula for teh union charts and one for the non-union charts, I can live with that.
 
Upvote 0
In every company that I ever worked for, holidays were booked by submitting a holiday request for one or more days. If approved, an "X" was placed in a box for each day in a spreadsheet maintained by HR that was read only to employees. That spreadsheet had the annual entitlement and days remaining for that holiday year.My solution allows you to calculate that annual holiday entitlement.
 
Upvote 0
I do think the principles of my previous post would allow you to get the asterisk you're looking for.

Instead of just using this portion of the formula from my previous post to return the number of vacation weeks an employee receives:
Code:
=MIN(VLOOKUP(DATEDIF(B2,TODAY(),"y"),{1,1;3,2;8,3;14,4;20,5;25,6},2),CHOOSE(MATCH(YEAR(B2),{1900,2002,2016}),6,5,4))

consider changing the TODAY() part to the relevant end dates.

For example, if you want to return an asterisk only where people have more vacation weeks this year than they did last year, you could use something like:

Code:
=IF(MIN(VLOOKUP(DATEDIF(B2,TODAY(),"y"),{1,1;3,2;8,3;14,4;20,5;25,6},2),CHOOSE(MATCH(YEAR(B2),{1900,2002,2016}),6,5,4))>MIN(VLOOKUP(DATEDIF(B2,EDATE(TODAY(),-12),"y"),{1,1;3,2;8,3;14,4;20,5;25,6},2),CHOOSE(MATCH(YEAR(B2),{1900,2002,2016}),6,5,4)),"*","")

Not sure if you're looking to specifically use today's date or if you should instead use Jan 1 of this year and last year... regardless, I wouldn't dismiss this approach just yet.
 
Upvote 0

Forum statistics

Threads
1,215,386
Messages
6,124,628
Members
449,176
Latest member
Dazjlbb

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