# How do I setup custom calculations?

Even though Yearli has many built in calculations for many different situations, there still may be times when you will need to create custom calculations.  Calculations help automate data entry by calculating fields, rather than having to manually key the numbers.  The Set Calculations screen is split into three sections; these sections are Enter Calculations, Amount Type ID List, and Match the Calculation to the Field.

Enter Calculations

Calculations are created and defined in this section. There is no limit for the number of calculations that can be entered. The list can be sorted by all calculations entered or calculations entered for the selected payer.  When entering the calculation formula each variable will be represented by an R code or a T code.  These codes are obtained from the Amount Type ID List.

Amount Type ID List

This list is used to determine the Amount Type ID used in the Enter Calculations section. “R” codes refer to the return level and “T” codes refer to the transaction level.

Match the Calculation to the Field

After the calculation formula has been entered, the Calculation ID is matched to the amount type requiring the calculation.

1. Click on the Payer List button.
2. Double click on the payer name.
3. Highlight a recipient.
4. Double click on the W-2 form in the Form List.
5. Click on the Calcs button in the upper right corner of the W-2 return or the transaction screen.
6. Click the Add button on the right side of the Set Calculations window.
7. Under Enter Calculations window enter the calculation name and formula.
8. Under the Match Calc ID to the Field window assign the Calc ID number to the Amount Type Name.
9. Click OK.

CALCULATION SYNTAX

Arithmetic Operator
Meaning Example
- (minus) Subtraction 2-2
* (asterisk) Multiplication 4*4
/ (slash) Division 2/2

Comparison Operator
Meaning Example
= (equal) Equal to R3=R1
> (greater than) Greater than R3>R1
< (less than) Less than R3<R1
>= (greater than or equal to) Greater than or equal to R3>=R1
<= (less than or equal to) Less than or equal to R3<=R1
<> (not equal to) Not Equal to R3<>R1

Calculation Function
Meaning Example
MIN Returns the smallest number of two values  MIN(R1,R3)
This statement will return the smaller of the two values.
MAX Returns the largest number of two values  MAX(R1,R3)
This statement will return the larger of the two values.
INT Rounds a number down to the nearest integer  INT(R3)
In this statement, R3 will be rounded down to the nearest integer.
ROUND Rounds a number to a specified number of digits. The second number specifies the number of digits to round to.  ROUND(R3,1)
In this statement, R3 will be rounded to have only one decimal place.
@IF Returns one value if a condition specified evaluates to TRUE and another value if it evaluates to FALSE. @IF(statement_to_be_evaluated, what_to_do_if_statement_is_true, what_to_do_if_statement_is_false)  @IF(R1<1000,R2*10,R2*2)
In this statement, if R1 is less than 1000, R2 will be multiplied by 10.
If R1 is greater than 1000, R2 will be multiplied by 2.