Calculating seniority up to a certain year

Let’s assume that knowing the date of employment, we would be interested in the seniority of employees (in years, months, possibly days), until the end of a certain year (even the current one).

Although SQL can be very useful, creating a VBA function can help when you want to use this calculation elsewhere in the database. If the date of employment of a person is not known, there is a risk of error in that field, which could confuse us. Therefore, it is good to condition the finding of this result in advance. A function suggestion is shown below.

A variant of calculating seniority, but using MS Excel I have shown in this post.

If it is necessary to calculate only the length of years, in order to be able to use it in the calculations, you can use this function derived from the one above.

Author: Ovidiu.S

I am quite passionate about this professional area as if I know something - no matter how little - I want to share it with others.

Leave a Reply