Payroll Setup > Company Setup > Formulas

# Basic Formulas

To create a formula for a custom item, you should have already selected the type of custom item, given it a name and selected “Formula” from the Input Type drop down menu. An additional field will then appear:

1. Enter a Formula by starting with an “=”.
2. You can then also enter variables, numbers and basic mathematical operators such as +, -, *, /, and ( ).

Examples of basic formulas that could be entered in the Formula field are the following:

• = normal_rate * 40 * 25
• = (basic_salary + normal_pay) / 4.3333 * 0.3333

Variables which can be used when creating formulas are:

• basic_salary: Basic Salary (salaried employees)
• normal_pay: Basic Hourly Rate (hourly paid employees)
• normal_rate: Hourly Rate
• shifts_worked: Number of shifts worked
• total_income: Total income
• min: Used to select the lowest of the values in the list provided to it
• max: Used to select the highest of the values in the list provided to it
• ceiling: Rounds up the number in brackets to the nearest whole number
• For example: = ceiling(1.1) = 2
• floor: Rounds down the number in brackets to the nearest whole number. The number will always be rounded down regardless of the decimal point
• For example: = floor(1.1) = 1 or = floor(2.7) = 2
• round: The number in brackets will be rounded up or down depending on the decimal. This functions as per the regular rounding of numbers
• For example: = round(1.1) = 1 or = round(1.5) = 2
• periods_in_year
• hourly_paid
• weeks: This amount is determined using the configured pay frequency. (Weekly = 1, fortnightly = 2, and either 4 or 5 for monthly payslips.
• default_days_worked: For monthly employees, equal to their full days per week (Regular Hours) x 4.333. For weekly paid employees, full days per week (Regular Hours).
• days_with_leave_for_system_type:
• For example: = normal_rate * days_with_leave_for_system_type(‘unpaid’). This would be the number of days taken with unpaid leave. Note: This considers days with unpaid leave, not days of unpaid leave.

# “IF” Statements

## General IF statements

The IF function returns one value if the specified condition is true and another IF false. The IF statement is also known as a logical formula: If, then, else. If something is true, then do this, else/otherwise do that.

The IF statement works as follows:

`if (condition, true statement, false statement) `

For example: Suppose that the company deducts a staff social fund contribution based on how much an employee earns. If the employee’s salary is greater than \$1 000, then the contribution is \$10, but if the employees earns less than \$1 000, then the contribution is \$8.

The formula will be written as:

= if (basic_salary>1000, 10, 8)

This means that if the basic salary is greater than 1 000, the result will be 10 and if it’s less it will be 8.

## Nested IF statements

A nested IF statement is an IF statement within an IF statement. It works as follows:

`if ( condition, true statement , ( if ( condition, true statement, false statement) ) `

For example: Suppose that the company deducts a staff social fund contribution based on how much an employee earns. If the employee’s salary is greater than \$1 000, then the contribution is \$10, but if the employees earns between \$500 and \$1 000, then the contribution is \$8, and if they earn less than \$500 it is \$6.

The formula will be written as follows:

= if (basic_salary>1000, 10, if (basic_salary<500, 6, 8)

This means that if the basic_salary is greater than 1 000, the result will be 10. Otherwise, if the salary is less than 500, the result will be 6, otherwise it will be 8.

You are using the help system of SimplePay, a payroll system that simplifies the payroll process. Designed just for Singapore, it's a fully online solution. Read more.