Math functions you can use in calculator formulas
Calconic formulas can do much more than add and multiply fields. With math functions you can round results, set a minimum or maximum value, raise numbers to a power, calculate square roots, work out averages and much more. This article lists all the main functions, with simple and real-world examples for each one.
Every input field in your calculator has its own unique ID, such as #1, #2 or #3. You use these IDs inside formulas, for example #1 + #2. If you are new to formulas, start with Writing a formula for a custom calculator widget.
For each function below you will find a short explanation, simple examples you can copy and adjust right away, and real-world examples – complete formulas for common calculator types.
How functions work
A function is a name followed by brackets. Whatever you put inside the brackets is what the function works on:
function(value)
function(value1, value2, ...)
The value can be a plain number, a field ID, or a whole formula:
round(4.7) → 5
round(#1) → rounds the value of field #1
round(#1 * #2 / 3) → rounds the result of the whole calculation
You can also put functions inside other functions:
round(max(#1, #2) * 1.21, 2)
Basic operators
Before getting to functions, here are the operators you can use between values:
| Operator | Meaning | Example | Result |
|---|---|---|---|
| + | Addition | 5 + 3 | 8 |
| - | Subtraction | 5 - 3 | 2 |
| * | Multiplication | 5 * 3 | 15 |
| / | Division | 6 / 3 | 2 |
| ^ | Power (exponent) | 2 ^ 3 | 8 |
| ( ) | Grouping – calculated first | (2 + 3) * 4 | 20 |
Calculations follow the standard order: brackets first, then powers, then multiplication and division, then addition and subtraction. When in doubt, add brackets.
Rounding functions
Rounding is the most common need in calculators – prices, quantities and measurements rarely look good with ten decimal places.
round() – round to the nearest number
Rounds to the nearest whole number. Halves (.5) are rounded up. Add a second value to choose how many decimal places to keep: round(value, decimals).
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| round(#1) | Rounds #1 to a whole number | #1 = 7.6 | 8 |
| round(#1) | #1 = 7.4 | 7 | |
| round(#1, 2) | Keeps 2 decimals | #1 = 3.14159 | 3.14 |
| round(#1, 1) | Keeps 1 decimal | #1 = 3.14159 | 3.1 |
| round(#1 + #2) | Rounds the sum of two fields | #1 = 2.3, #2 = 4.4 | 7 |
| round(#1 / 3, 2) | Divides by 3, keeps 2 decimals | #1 = 10 | 3.33 |
Real-world examples
Price with 21% VAT, rounded to cents (#1 = price without VAT):
round(#1 * 1.21, 2)
BMI with one decimal (#1 = weight in kg, #2 = height in cm):
round(#1 / (#2 / 100) ^ 2, 1)
70 kg and 175 cm gives 22.9.
Percentage, rounded to a whole number (#1 = part, #2 = total):
round(#1 / #2 * 100)
45 out of 60 gives 75.
ceil() – always round up
Rounds up to the next whole number, even if the decimal part is tiny. Whole numbers stay as they are.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| ceil(#1) | Rounds #1 up | #1 = 4.2 | 5 |
| ceil(#1) | Whole numbers do not change | #1 = 4 | 4 |
| ceil(#1 / #2) | Divides and rounds up | #1 = 10, #2 = 3 | 4 |
| ceil(#1 / 10) | How many groups of 10 | #1 = 43 | 5 |
| ceil(#1 * 1.1) | Adds 10% and rounds up | #1 = 25 | 28 |
Real-world examples
Paint cans needed (#1 = wall area in m², one can covers 10 m²):
ceil(#1 / 10)
A 43 m² wall gives 5 cans.
Tile boxes needed with 10% extra for cutting (#1 = floor area in m², #2 = m² per box):
ceil(#1 * 1.1 / #2)
20 m² with boxes of 1.44 m² gives 16 boxes.
Billable hours, where every started hour counts (#1 = minutes worked):
ceil(#1 / 60)
95 minutes gives 2 hours.
Number of buses needed for a group (#1 = people, 50 seats per bus):
ceil(#1 / 50)
More details in Rounding calculator results up to the next integer.
floor() – always round down
Rounds down to the previous whole number.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| floor(#1) | Rounds #1 down | #1 = 4.8 | 4 |
| floor(#1 / #2) | Divides and rounds down | #1 = 100, #2 = 30 | 3 |
| floor(#1 / 12) | Full dozens / full years from months | #1 = 30 | 2 |
Real-world examples
How many items the customer can afford (#1 = budget, #2 = price per item):
floor(#1 / #2)
A budget of 100 and items costing 30 gives 3 items.
Full boxes that can be packed (#1 = number of items, 12 per box):
floor(#1 / 12)
Age in full years (#1 = age in months):
floor(#1 / 12)
More details in Rounding calculator results down to the nearest integer.
fix() – remove the decimal part
Cuts off the decimals and keeps only the whole number part. For positive numbers it works like floor(); for negative numbers it rounds toward zero.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| fix(#1) | Drops the decimals | #1 = 4.9 | 4 |
| fix(#1) | Negative numbers go toward zero | #1 = -4.9 | -4 |
| fix(#1 - #2) | Drops decimals of a difference | #1 = 3, #2 = 7.5 | -4 |
For comparison, floor(-4.9) gives -5.
Use it for: results that can be negative (profit/loss, temperature differences) where you just want to drop the decimals.
Rounding to the nearest 5, 10, 100…
There is no separate function for this, but you can combine rounding with division and multiplication: divide by the step, round, then multiply back.
| Formula | What it does | Example values | Result |
|---|---|---|---|
| round(#1 / 5) * 5 | Nearest 5 | #1 = 23 | 25 |
| ceil(#1 / 10) * 10 | Up to the next 10 | #1 = 23 | 30 |
| floor(#1 / 100) * 100 | Down to the hundred | #1 = 1280 | 1200 |
| round(#1 / 0.05) * 0.05 | Nearest 0.05 (cash prices) | #1 = 4.47 | 4.45 |
| ceil(#1) - 0.01 | Price ending in .99 | #1 = 18.40 | 18.99 |
Minimum and maximum values
max() – the highest value (set a minimum)
Returns the largest of the values you give it. You can pass two or more values.
The most common use is to make sure a result never goes below a certain number: max(#1, 3) means "use #1, but at least 3".
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| max(#1, 3) | Returns 3 if #1 is lower than 3, otherwise #1 | #1 = 1 | 3 |
| max(#1, 3) | #1 = 8 | 8 | |
| max(#1, 0) | Never returns a negative number | #1 = -5 | 0 |
| max(#1, #2) | The higher of two fields | #1 = 25, #2 = 18 | 25 |
| max(#1, #2, #3) | The highest of three fields | #1 = 5, #2 = 9, #3 = 2 | 9 |
| max(#1 - #2, 0) | Difference, but not below 0 | #1 = 10, #2 = 14 | 0 |
| max(#1 * 2, 15) | Calculation with a minimum of 15 | #1 = 4 | 15 |
Note: max(#1, 3) gives the same result as the conditional formula ((#1 < 3)?(3):(#1)), but is shorter and easier to read.
Real-world examples
Shipping costs 2 per kg, but at least 15 (#1 = weight in kg):
max(#1 * 2, 15)
Minimum order quantity of 10 (#1 = quantity entered, #2 = price per item):
max(#1, 10) * #2
A customer ordering 3 items at 5 each still pays for 10: 50.
Minimum one billable hour (#1 = hours, #2 = hourly rate):
max(#1, 1) * #2
Remaining balance that can't go negative (#1 = budget, #2 = spent):
max(#1 - #2, 0)
min() – the lowest value (set a maximum)
Returns the smallest of the values you give it.
The most common use is to make sure a result never goes above a certain number: min(#1, 100) means "use #1, but no more than 100".
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| min(#1, 100) | Returns 100 if #1 is higher than 100, otherwise #1 | #1 = 150 | 100 |
| min(#1, 100) | #1 = 40 | 40 | |
| min(#1, #2) | The lower of two fields | #1 = 25, #2 = 18 | 18 |
| min(#1, #2, #3) | The lowest of three fields | #1 = 5, #2 = 9, #3 = 2 | 2 |
| min(#1 * 0.1, 50) | 10% of #1, but no more than 50 | #1 = 800 | 50 |
Note: min(#1, 100) gives the same result as ((#1 > 100)?(100):(#1)).
Real-world examples
10% discount, but no more than 50 (#1 = order total):
min(#1 * 0.10, 50)
Quantity limited to available stock (#1 = quantity ordered, #2 = in stock):
min(#1, #2)
Insurance payout limited to 5 000 (#1 = damage amount):
min(#1, 5000)
Which one should I use?
It's easy to mix them up, so here is a simple rule:
| You want… | Use | Example |
|---|---|---|
| At least X | max() | max(#1, 3) – never less than 3 |
| No more than X | min() | min(#1, 100) – never more than 100 |
| Between X and Y | both | min(max(#1, 3), 100) – between 3 and 100 |
Keeping a result between a minimum and a maximum
Put max() inside min():
| Formula | What it does | Example values | Result |
|---|---|---|---|
| min(max(#1, 1), 10) | Keeps #1 between 1 and 10 | #1 = 15 | 10 |
| min(max(#1, 1), 10) | #1 = 0 | 1 | |
| min(max(#1, 1), 10) | #1 = 5 | 5 |
Real-world example – a 5% fee, but never less than 10 and never more than 200 (#1 = amount):
min(max(#1 * 0.05, 10), 200)
Positive and negative values
abs() – absolute value
Removes the minus sign, so the result is always positive.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| abs(#1) | Removes the minus sign | #1 = -7 | 7 |
| abs(#1) | Positive numbers don't change | #1 = 7 | 7 |
| abs(#1 - #2) | Difference, always positive | #1 = 10, #2 = 14 | 4 |
Real-world examples
Difference between planned and actual cost, whichever is higher (#1 = planned, #2 = actual):
abs(#1 - #2)
Percentage difference (#1 = old value, #2 = new value):
round(abs(#1 - #2) / #1 * 100, 1)
From 200 to 170 gives 15 (%).
sign() – positive, negative or zero
Returns 1 for positive numbers, -1 for negative numbers and 0 for zero.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| sign(#1) | 1 if positive | #1 = 25 | 1 |
| sign(#1) | -1 if negative | #1 = -3 | -1 |
| sign(#1) | 0 if zero | #1 = 0 | 0 |
Real-world example – add a one-time setup fee of 25 only if something is ordered (#1 = quantity, price 10 each):
#1 * 10 + 25 * sign(#1)
Quantity 0 gives 0; quantity 3 gives 55.
Powers and roots
pow() – raise to a power
pow(x, y) multiplies x by itself y times. It does exactly the same as x ^ y, so you can use whichever you find easier to read.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| pow(#1, 2) or #1 ^ 2 | Square of #1 | #1 = 5 | 25 |
| pow(#1, 3) or #1 ^ 3 | Cube of #1 | #1 = 3 | 27 |
| pow(#1, #2) | #1 to the power of #2 | #1 = 2, #2 = 10 | 1024 |
| round(pow(1 + #1 / 100, #2), 4) | Growth factor for #1% over #2 periods | #1 = 10, #2 = 2 | 1.21 |
Real-world examples
Area of a square room (#1 = side length):
#1 ^ 2
Compound interest (#1 = amount, #2 = yearly rate in %, #3 = years):
round(#1 * pow(1 + #2 / 100, #3), 2)
10 000 at 5% for 10 years gives 16 288.95.
Monthly loan payment (#1 = loan amount, #2 = yearly interest rate in %, #3 = number of months):
round((#1 * (#2 / 100 / 12)) / (1 - pow(1 + #2 / 100 / 12, -#3)), 2)
A 20 000 loan at 6% for 60 months gives 386.66 per month.
Note: this loan formula divides by zero if the interest rate is 0. If 0% is possible in your calculator, wrap it in an IF condition: ((#2 == 0)?(round(#1 / #3, 2)):(...loan formula...)). See conditional formulas.
sqrt() – square root
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| sqrt(#1) | Square root of #1 | #1 = 16 | 4 |
| round(sqrt(#1), 2) | Square root with 2 decimals | #1 = 2 | 1.41 |
| sqrt(#1 * #2) | Square root of a product | #1 = 4, #2 = 9 | 6 |
Real-world examples
Side length of a square from its area (#1 = area in m²):
sqrt(#1)
Diagonal of a screen, room or rectangle (#1 = width, #2 = height):
round(sqrt(#1 ^ 2 + #2 ^ 2), 1)
120 × 70 gives 138.9.
cbrt() – cube root
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| cbrt(#1) | Cube root of #1 | #1 = 27 | 3 |
| cbrt(#1) | #1 = 64 | 4 |
Real-world example – edge length in metres of a cube-shaped tank (#1 = volume in litres):
round(cbrt(#1 / 1000), 2)
1 000 litres gives 1 m.
nthRoot() – any root
nthRoot(x, n) returns the n-th root of x. Note the capital R.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| nthRoot(#1, 4) | 4th root of #1 | #1 = 81 | 3 |
| nthRoot(#1, #2) | #2-th root of #1 | #1 = 32, #2 = 5 | 2 |
Real-world example – average yearly growth rate (CAGR) in % (#1 = start value, #2 = end value, #3 = years):
round((nthRoot(#2 / #1, #3) - 1) * 100, 2)
Growing from 100 to 200 in 5 years gives 14.87 (%).
hypot() – length of the diagonal
hypot(a, b) is a shortcut for sqrt(a^2 + b^2). It also works with three values for the diagonal of a box.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| hypot(#1, #2) | Diagonal of a rectangle | #1 = 3, #2 = 4 | 5 |
| hypot(#1, #2, #3) | Diagonal of a box | #1 = 2, #2 = 3, #3 = 6 | 7 |
Real-world example – rafter length of a roof (#1 = horizontal run, #2 = rise):
round(hypot(#1, #2), 2)
Division and remainders
mod() – remainder after division
mod(x, y) returns what is left over after dividing x by y.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| mod(#1, 3) | Remainder after dividing by 3 | #1 = 10 | 1 |
| mod(#1, 2) | 0 if #1 is even, 1 if odd | #1 = 7 | 1 |
| mod(#1, 12) | Items left after full dozens | #1 = 30 | 6 |
| mod(#1, 60) | Minutes left after full hours | #1 = 135 | 15 |
Real-world examples
Full boxes and loose items (#1 = number of items, 12 per box) – use two formula fields:
floor(#1 / 12) → full boxes
mod(#1, 12) → items left over
30 items gives 2 full boxes and 6 loose items.
Hours and minutes from total minutes (#1 = minutes):
floor(#1 / 60) → hours
mod(#1, 60) → minutes
135 minutes gives 2 hours and 15 minutes.
Weeks and days (#1 = number of days):
floor(#1 / 7) → weeks
mod(#1, 7) → days
Extra charge for odd quantities (for example, items sold in pairs):
((mod(#1, 2) == 1)?(5):(0))
Totals and averages
These functions accept as many values as you need, separated by commas.
sum() – total
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| sum(#1, #2) | Adds two fields | #1 = 10, #2 = 20 | 30 |
| sum(#1, #2, #3) | Adds three fields | #1 = 10, #2 = 20, #3 = 30 | 60 |
| sum(#1, #2, #3) * 1.21 | Total plus 21% VAT | #1 = 10, #2 = 20, #3 = 30 | 72.6 |
sum(#1, #2, #3) works the same as #1 + #2 + #3, but is easier to read when you have many fields.
mean() – average
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| mean(#1, #2) | Average of two fields | #1 = 4, #2 = 7 | 5.5 |
| mean(#1, #2, #3) | Average of three fields | #1 = 4, #2 = 8, #3 = 6 | 6 |
| round(mean(#1, #2, #3), 1) | Average with one decimal | #1 = 4, #2 = 5, #3 = 5 | 4.7 |
Real-world example – average score from several rating fields:
round(mean(#1, #2, #3, #4), 1)
median() – middle value
Sorts the values and returns the one in the middle. Unlike the average, one very high or very low value does not pull it up or down.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| median(#1, #2, #3) | Middle value of three | #1 = 1, #2 = 3, #3 = 100 | 3 |
| round(mean(#1, #2, #3), 2) | Average, for comparison | #1 = 1, #2 = 3, #3 = 100 | 34.67 |
| median(#1, #2, #3, #4) | With an even count, the average of the two middle values | #1 = 1, #2 = 3, #3 = 5, #4 = 100 | 4 |
prod() – multiply all values
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| prod(#1, #2) | Multiplies two fields (area) | #1 = 4, #2 = 5 | 20 |
| prod(#1, #2, #3) | Multiplies three fields (volume) | #1 = 2, #2 = 3, #3 = 4 | 24 |
Real-world example – concrete needed in m³ (#1 = length, #2 = width, #3 = thickness in cm):
round(prod(#1, #2, #3 / 100), 2)
Logarithms and exponents
These are mostly used for finance, science and engineering calculators.
exp() – e to the power of x
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| exp(#1) | e to the power of #1 | #1 = 1 | 2.718… |
| round(exp(#1), 2) | Rounded | #1 = 2 | 7.39 |
Real-world examples
Continuously compounded interest (#1 = amount, #2 = rate in %, #3 = years):
round(#1 * exp(#2 / 100 * #3), 2)
Value after depreciation or decay (#1 = starting value, #2 = decay rate in %, #3 = years):
round(#1 * exp(-#2 / 100 * #3), 2)
log() – logarithm
log(x) returns the natural logarithm (base e). Add a second value to choose a different base: log(x, base).
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| log(#1, 10) | Base-10 logarithm | #1 = 100 | 2 |
| log(#1, 2) | Base-2 logarithm | #1 = 8 | 3 |
| round(log(#1, #2), 4) | Logarithm of #1 with base #2 | #1 = 81, #2 = 3 | 4 |
| round(log(#1), 3) | Natural logarithm | #1 = 10 | 2.303 |
Real-world examples
Years until an investment doubles (#1 = yearly rate in %):
round(log(2) / log(1 + #1 / 100), 1)
At 7% the money doubles in about 10.2 years.
Full years needed to reach a savings goal (#1 = current amount, #2 = goal, #3 = yearly rate in %):
ceil(log(#2 / #1) / log(1 + #3 / 100))
From 1 000 to 2 000 at 7% gives 11 years.
log10() and log2()
Shortcuts for base-10 and base-2 logarithms.
| Formula | What it does | Example values | Result |
|---|---|---|---|
| log10(#1) | Base-10 logarithm | #1 = 1000 | 3 |
| log2(#1) | Base-2 logarithm | #1 = 64 | 6 |
Real-world example – power ratio in decibels (#1 = output power, #2 = input power):
round(10 * log10(#1 / #2), 1)
A ratio of 100 gives 20 dB.
Trigonometry
Calconic supports sin(), cos(), tan() and their inverses asin(), acos(), atan().
Important: these functions work in radians, not degrees.
- To use an angle in degrees, multiply it by pi / 180 inside the function.
- To get a result in degrees from asin(), acos() or atan(), multiply the result by 180 / pi.
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| round(sin(#1 * pi / 180), 4) | Sine of #1 degrees | #1 = 30 | 0.5 |
| round(cos(#1 * pi / 180), 4) | Cosine of #1 degrees | #1 = 60 | 0.5 |
| round(tan(#1 * pi / 180), 4) | Tangent of #1 degrees | #1 = 45 | 1 |
| round(atan(#1) * 180 / pi, 1) | Angle in degrees from a ratio | #1 = 1 | 45 |
Tip: wrap trigonometry results in round() – otherwise you may see results like 0.49999999999999994 instead of 0.5.
Real-world examples
Height of a ramp (#1 = ramp length, #2 = angle in degrees):
round(#1 * sin(#2 * pi / 180), 2)
Roof pitch angle in degrees (#1 = rise, #2 = run):
round(atan(#1 / #2) * 180 / pi, 1)
Slope in % converted to degrees (#1 = slope in %):
round(atan(#1 / 100) * 180 / pi, 1)
A 10% slope gives 5.7°.
Combinations and factorials
factorial() – n!
Multiplies all whole numbers from 1 up to n. You can also write n!.
| Formula | What it does | Example values | Result |
|---|---|---|---|
| factorial(#1) | 1 × 2 × … × #1 | #1 = 4 | 24 |
| #1! | Same, shorter | #1 = 5 | 120 |
Real-world example – number of ways to seat #1 guests in a row: factorial(#1).
combinations() – how many ways to choose
combinations(n, k) – how many different groups of k items can be picked from n items when order does not matter.
| Formula | What it does | Example values | Result |
|---|---|---|---|
| combinations(#1, 2) | Pairs from #1 items | #1 = 5 | 10 |
| combinations(#1, #2) | Groups of #2 from #1 | #1 = 10, #2 = 3 | 120 |
Real-world examples
Possible pizzas with 3 toppings out of #1 available:
combinations(#1, 3)
Number of matches in a round-robin tournament (#1 = teams):
combinations(#1, 2)
8 teams play 28 matches.
permutations() – how many ways to arrange
Same as above, but order matters.
| Formula | What it does | Example values | Result |
|---|---|---|---|
| permutations(#1, 2) | Ordered pairs from #1 items | #1 = 5 | 20 |
| permutations(#1, #2) | Ordered groups of #2 from #1 | #1 = 10, #2 = 3 | 720 |
Real-world example – ways to award gold, silver and bronze among #1 participants: permutations(#1, 3).
Constants
You can use these named values directly in a formula:
| Constant | Value | Typical use |
|---|---|---|
| pi | 3.14159… | Circles, cylinders, angles |
| e | 2.71828… | Growth and decay |
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| round(pi * #1 ^ 2, 2) | Area of a circle from radius | #1 = 2 | 12.57 |
| round(2 pi #1, 2) | Circumference from radius | #1 = 2 | 12.57 |
| round(pi * #1, 2) | Circumference from diameter | #1 = 10 | 31.42 |
Real-world examples
Area of a circle from its diameter (#1 = diameter):
round(pi * (#1 / 2) ^ 2, 2)
Volume of a round pool in litres (#1 = diameter in m, #2 = depth in m):
round(pi * (#1 / 2) ^ 2 * #2 * 1000)
A 4 m pool, 1.2 m deep, holds 15 080 litres.
Combining functions with IF conditions
All functions can be used inside conditional formulas, and conditions can be used inside functions. The IF syntax is:
((condition)?(value if true):(value if false))
Simple examples
| Formula | What it does | Example values | Result |
|---|---|---|---|
| ((#1 > 100)?(round(#1 * 0.9, 2)):(#1)) | 10% off if #1 is over 100 | #1 = 150 | 135 |
| ((#1 > 100)?(round(#1 * 0.9, 2)):(#1)) | #1 = 80 | 80 | |
| ceil(((#1 > 5)?(#1 * 1.2):(#1))) | Adds 20% above 5, then rounds up | #1 = 7 | 9 |
Real-world example – free shipping over 100, otherwise 5% of the order but at least 4.99 (#1 = order total):
((#1 >= 100)?(0):(max(round(#1 * 0.05, 2), 4.99)))
Read more in Writing a conditional formula (IF) for a calculator widget.
Quick reference
| Function | What it does | Example | Result |
|---|---|---|---|
| round(x) | Nearest whole number | round(4.5) | 5 |
| round(x, n) | Round to n decimals | round(3.14159, 2) | 3.14 |
| ceil(x) | Round up | ceil(4.1) | 5 |
| floor(x) | Round down | floor(4.9) | 4 |
| fix(x) | Drop decimals (toward zero) | fix(-4.9) | -4 |
| max(a, b, …) | Highest value / set a minimum | max(1, 3) | 3 |
| min(a, b, …) | Lowest value / set a maximum | min(150, 100) | 100 |
| abs(x) | Remove minus sign | abs(-7) | 7 |
| sign(x) | 1, -1 or 0 | sign(-3) | -1 |
| pow(x, y) | Power (same as x ^ y) | pow(2, 3) | 8 |
| sqrt(x) | Square root | sqrt(16) | 4 |
| cbrt(x) | Cube root | cbrt(27) | 3 |
| nthRoot(x, n) | n-th root | nthRoot(16, 4) | 2 |
| hypot(a, b) | Diagonal length | hypot(3, 4) | 5 |
| mod(x, y) | Remainder | mod(10, 3) | 1 |
| sum(a, b, …) | Total | sum(1, 2, 3) | 6 |
| mean(a, b, …) | Average | mean(4, 8, 6) | 6 |
| median(a, b, …) | Middle value | median(1, 3, 100) | 3 |
| prod(a, b, …) | Multiply all | prod(2, 3, 4) | 24 |
| exp(x) | e to the power of x | exp(1) | 2.718… |
| log(x) | Natural logarithm | log(e) | 1 |
| log(x, base) | Logarithm with base | log(8, 2) | 3 |
| log10(x) | Base-10 logarithm | log10(1000) | 3 |
| log2(x) | Base-2 logarithm | log2(64) | 6 |
| sin(x), cos(x), tan(x) | Trigonometry (radians) | sin(pi / 2) | 1 |
| asin(x), acos(x), atan(x) | Inverse trigonometry | atan(1) | 0.785… |
| factorial(n) | n! | factorial(5) | 120 |
| combinations(n, k) | Choose k from n | combinations(5, 2) | 10 |
| permutations(n, k) | Arrange k from n | permutations(5, 2) | 20 |
| pi | 3.14159… | pi * 2 | 6.283… |
| e | 2.71828… | e ^ 2 | 7.389… |
Tips
- Function names are case-sensitive. Write round(), not Round() or ROUND(). Note nthRoot() has a capital R.
- Use commas between values inside a function: max(#1, #2). Use a dot for decimals: 0.25, not 0,25.
- Check your brackets. Every opening bracket needs a closing one. Long formulas are easier to check if you build them step by step.
- Round at the end. Rounding in the middle of a formula can make the final result less accurate. Wrap the whole formula instead: round(#1 #2 1.21, 2).
- Avoid dividing by zero. If a field can be empty or 0, protect divisions with an IF condition or max(#2, 1).
- Test with real numbers. Use the preview to try a few typical values and edge cases (0, very large numbers, negative numbers) before publishing.