# How to Create a Custom Math Formula

Skill Level: Intermediate

## Walkthrough

In-Depth
When you add Magic Text, the last option in the menu is "New Formula...". When you select this option, a chip called "Custom Formula" is added to your text box. To enter the formula:
• Click on the Custom Formula chip to open the formula editor
• Here you can type any number, as well as the following operators
• `+` for addition
• `-` for subtraction
• `/` for division
• `*` or `x` for multiplication
• `(` and `)` for parentheses
• You can also insert a Magic Number by clicking the Magic Number icon • Magic Numbers use Number properties from your database
• You can also filter Magic Numbers that are Counts, Sums, Averages etc of related collections
• The Magic Number icon will also give you the option to insert a function. The following functions are supported:
• Round
• Rounds a number to the nearest integer
• ROUND(4.32) will display was 4
• ROUND(4.5) will display as 5
• Integer
• Removes the decimals from a number. (You can also think of this as rounding down.)
• INT(4.32) will display as 4
• INT(4.5) will display as 4
• INT(4.999) will display as 4
• Absolute Value
• Displays the absolute value of a number
• ABS(4.32) will display as 4.32
• ABS(-4.32) will display as 4.32
• Square Root
• Displays the square root of a number
• SQRT(9) will display as 3
• Exponent
• Displays one number taken to the power of another
• EXP(3,2) will display as 9 (which is 3^2 or 3 to the 2nd power)
• Random Number
• Will display a random number between any two values you specify
• RAND(0,1) will display a random number between 0 and 1
• Log
• Displays the base 10 logarithm of a number
• LOG(100) will display as 2
Let's take a look at an example. If we have the total cost for a trip and the number of people who can go on that trip, but want to see the trip cost per person, we can use a custom math formula.
1. 1.
Insert a text box
2. 2.
Select the red accented letter to insert Magic Text
3. 3.
Select New Formula from the popup list
4. 4.
Click on the pencil icon to open the formula editor
5. 5.
Click on the Magic Number icon to select Trip Cost
6. 6.
Enter "/"
7. 7.
Click on the Magic Number icon to select Group Size
8. 8.
As with any numbers, you can edit the prefixes/suffixes and format custom formulas as well 