# Calculate off days automatically

Topic Labels: Formulas
Solved
1130 2
cancel
Showing results for
Did you mean:
4 - Data Explorer

Hello there,
I have been using Airtable for a few years now and I absolutely love it.

I am creating a basic HR system for a startup and I want to create a formula for the employees’ paid leaves.
Basically, each employee should receive 2 days off for every month they work for. it should be added by the end of each month.

How do I automatically make it add up in Airtable, using the joining date only?

Is there a formula for that?

1 Solution

Accepted Solutions
16 - Uranus

Try this simplified version of the much more complicated formula I use to calculate accrued amounts:

DATETIME_DIFF(TODAY(),{1st of First Accrual Month}, 'months') * 16

Its getting the number of whole months between right now and the first month that the employee began. Its multiplied by 16 to get the number of hours earned per month (assuming 2 days = 2 * 8 hours). Change 16 to 2 if you want whole days and not hours.

The above formula relies on a field called {1st of First Accrual Month} which gets the first day of the month an employee began working. Its formula is DATETIME_FORMAT({Start Date},'YYYY-MM-01')

2 Replies 2
16 - Uranus

Try this simplified version of the much more complicated formula I use to calculate accrued amounts:

DATETIME_DIFF(TODAY(),{1st of First Accrual Month}, 'months') * 16

Its getting the number of whole months between right now and the first month that the employee began. Its multiplied by 16 to get the number of hours earned per month (assuming 2 days = 2 * 8 hours). Change 16 to 2 if you want whole days and not hours.

The above formula relies on a field called {1st of First Accrual Month} which gets the first day of the month an employee began working. Its formula is DATETIME_FORMAT({Start Date},'YYYY-MM-01')

4 - Data Explorer

Thanks a million this is really helpful. I replaced the 16 with 2 and it worked!