> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runway.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prorated salaries

> Use Runway’s date math functions to model prorated salaries for employees who start or leave mid-month with precision.

This guide walks through adding a prorated salary field to your HRIS-sourced Employee database.

As a reminder, HRIS databases work differently than other Runway databases. For more information, please refer to our [HRIS databases article](https://docs.runway.com/concepts/databases/hris-databases#hris-databases).

## Step 1: Create `Prorated Monthly Salary` field

In your **Employee database**, add a **Number field**.

<img src="https://mintcdn.com/runway-5055a12e/tzN-u1troKtnvvuu/images/prorated-salaries/prorated-salaries-step1-create-field.png?fit=max&auto=format&n=tzN-u1troKtnvvuu&q=85&s=bea49473283d38aa3626b68d768d162f" alt="Prorated Salaries Step1 Create Field Pn" width="2162" height="1088" data-path="images/prorated-salaries/prorated-salaries-step1-create-field.png" />

Name the field **Prorated Monthly Salary**.

## Step 2: Handle mid-month starts

1. Add a formula to **Prorated Salary**. Begin with an `if()` statement that checks if the start date falls within the current month.

<img src="https://mintcdn.com/runway-5055a12e/tzN-u1troKtnvvuu/images/prorated-salaries/prorated-salaries-step2-1.png?fit=max&auto=format&n=tzN-u1troKtnvvuu&q=85&s=887ccb25426a6b19f87ccae20a549cee" alt="Prorated Salaries Step2 1 Pn" width="890" height="116" data-path="images/prorated-salaries/prorated-salaries-step2-1.png" />

2. If true, use the `dateDiff()` function to calculate the difference in days between the start date and the end of that month. You'll also want to add 1 day onto this, to ensure you're including the starting day too.

<img src="https://mintcdn.com/runway-5055a12e/tzN-u1troKtnvvuu/images/prorated-salaries/prorated-salaries-step2-2.png?fit=max&auto=format&n=tzN-u1troKtnvvuu&q=85&s=ef9b09d35f033d5dd8f8adc77675726c" alt="Prorated Salaries Step2 2 Pn" width="1172" height="232" data-path="images/prorated-salaries/prorated-salaries-step2-2.png" />

3. Use `daysInMonth()` to divide by the total days in the month and calculate the prorated percentage.

<img src="https://mintcdn.com/runway-5055a12e/tzN-u1troKtnvvuu/images/prorated-salaries/prorated-salaries-step2-3.png?fit=max&auto=format&n=tzN-u1troKtnvvuu&q=85&s=b1c822ac32c4f3dc626c1899b227aa05" alt="Prorated Salaries Step2 3 Pn" width="1172" height="222" data-path="images/prorated-salaries/prorated-salaries-step2-3.png" />

4. Multiply this prorated fraction by the employee's monthly salary (annual salary divided by 12).

<img src="https://mintcdn.com/runway-5055a12e/tzN-u1troKtnvvuu/images/prorated-salaries/prorated-salaries-step2-4.png?fit=max&auto=format&n=tzN-u1troKtnvvuu&q=85&s=9c1153d876a4c4ea0136f41da64b1153" alt="Prorated Salaries Step2 4 Pn" width="1164" height="226" data-path="images/prorated-salaries/prorated-salaries-step2-4.png" />

## Step 3: Account for mid-month terminations

Extend your `IF()` formula to account for employees who terminate mid-month by adding a second condition.

1. Add a second `IF()` statement by copying the formula so far, and pasting it at the end.
2. Then, update `This Employee.Start Date` to `This Employee.Termination Date` by clicking on each reference of `This Employee.Start Date` -> hitting *Column* -> and then referencing `This Employee.Termination Date` instead.
3. Next, you'll want to update the dateDiff() function so that the first argument is the *start* of the termination month, and the second argument is just the Termination Date itself.

<img src="https://mintcdn.com/runway-5055a12e/tzN-u1troKtnvvuu/images/prorated-salaries/prorated-salaries-step3.png?fit=max&auto=format&n=tzN-u1troKtnvvuu&q=85&s=810f898801339fa56ff8646719d28a26" alt="Prorated Salaries Step3 Pn" width="1160" height="404" data-path="images/prorated-salaries/prorated-salaries-step3.png" />

## Step 4: Calculate full-month salaries

Finally, handle the default case where the employee worked the full month. Set the final case to the (annual) pay rate / 12 for full-month employees.

<img src="https://mintcdn.com/runway-5055a12e/tzN-u1troKtnvvuu/images/prorated-salaries-step4-final-formula.png?fit=max&auto=format&n=tzN-u1troKtnvvuu&q=85&s=f4892e3e38610779a5d46be92baf715b" alt="Prorated Salaries Step4 Final Formula Pn" width="1166" height="400" data-path="images/prorated-salaries-step4-final-formula.png" />

Hit **Enter** to save your formula and review your data. This column formula automatically applies to all employees in your database.

<img src="https://mintcdn.com/runway-5055a12e/tzN-u1troKtnvvuu/images/prorated-salaries/prorated-salaries-step4-save.png?fit=max&auto=format&n=tzN-u1troKtnvvuu&q=85&s=d18e1f9cc8c2c3eddf2660cea7df3313" alt="Prorated Salaries Step4 Save Pn" width="2850" height="720" data-path="images/prorated-salaries/prorated-salaries-step4-save.png" />

For additional information about headcount planning, see [this article](https://docs.runway.com/guides/modeling/headcount-planning).
