Re is out: see what's new Lifetime updates on every purchase Support replies within 24 hours Secure checkout via Gumroad 8,500+ sales since 2016

Calculator

Updated 3 min read 4 views

The Calculator add-on adds a Calculation field: a number worked out from the other fields as visitors fill the form in, such as a price, a total or a number of nights. Find it under More in the field buttons.

Write the formula

Click the field’s chip. Under Formula, click the parts you need, or type:

  • Fields: the form’s fields. A click puts [qty] where the cursor is.
  • Signs: + − × ÷ and brackets.
  • Ready-made: Round, Larger of, Smaller of, If… then… else, How many ticked, Age, Days between. Select part of the formula first and the ready-made part goes around it.

The formula is checked as you type. A problem shows in plain words, such as “No field in this form is named [qtty]” or “A bracket is missing or extra”. When it reads well, you see what it gives with the form as it opens: “With the form as it opens: $200.00”.

Prices of options

A select, radio or checkbox counts the number in its option values. Write the price before the name, such as 100 : Basic and 250 : Pro. Ticked checkboxes add up. Options without a number count as 0, and the formula’s sidebar names them.

A Number or Text field counts what visitors type. A repeated group’s field adds up its rows.

Compare with an option

To do something for one option, compare the field with its value in quotes. With a radio [deal] of sale-5 : Sale and extra-5 : Extra, a sale takes 5% off and an extra adds 5:

[price] × if([deal] == "sale-5", 0.95, 1) + if([deal] == "extra-5", 5, 0)

== and === both work, and != means “is not”. Text is compared as text, without minding capitals; for checkboxes, it matches when that option is ticked. Under Options of deal in the formula’s sidebar, a click puts an option’s value in quotes for you. A value written without quotes, such as sale-5, is read as sale minus 5, and the formula says so.

Examples

WhatFormula
Quantity times plan[qty] × [plan]
Free delivery over 100, else 15if([subtotal] > 100, 0, 15)
20% tax, roundedround([subtotal] × 0.2, 2)
Nights between two datesdays([check_in], [check_out])
Age from a birthdayage([birthday])
Never below 0max([total] − [discount], 0)

All functions: min, max, sum, count, abs, round(x, 2), ceil, floor, sqrt, pow, if(condition, then, else), with > < >= <= == != (=== and !== too) and, or. Dates: age, days, months, today(), year, month, day, weekday.

Promo codes: with the Coupons add-on, discount([subtotal], [promo]) gives the subtotal less the code’s discount. The codes stay on your server, with an end date and a limit of uses: Coupons. Add-ons can add functions of their own (remaily_formula_function).

Several totals

A Calculation field can use another: a subtotal, the tax from it, the total from both. Turn on Work it out without showing it for a step only other formulas, the mail or a payment need.

How it shows

Decimals, Decimal mark (9.99 or 9,99), Thousands (1 000, 1,000, 1.000, 1’000 or 1000), and text Before the number or After the number, such as $ or €.

In the rest of the form

  • Rules: a group can show or hide on a Calculation field like on any other, such as Total is more than 10000.
  • Mail: [total] prints it formatted ($1 250.00), [_raw_total] the plain number (1250.00).
  • Payments: pick the Calculation field as a Stripe or PayPal field’s Amount from, and the total is what visitors pay.

The server works every formula out again when the form is sent, from what was sent, so the total in the mail, the entry and the payment can’t be changed in the browser. A Calculation field can’t go in a repeated group.

Was this article helpful?