sum()
Add up numeric values from a Checkbox group variable — the standard way to total optional add-ons, upsells, or multi-select features in ecommerce and service quotes.
Syntax
Every formula in Calcopolis must start with = in the Value field:
= sum(checkbox_variable)
| Part | Rule |
|---|---|
| Function name | sum — lowercase |
| Arguments | One — the Name of a Checkbox widget |
| Return value | Sum of selected option values (0 if nothing selected) |
Valid examples
= sum(addons)
= subtotal + sum(extras)
= sum(selected_services) * visit_count
Invalid / unsupported
| Don't write | Why |
|---|---|
sum(addon_a, addon_b) |
Pass the checkbox group Name once — not individual options |
sum on a Number field |
sum expects a checkbox array; use + for single numbers |
{{ sum(addons) }} |
Use = sum(...) in formulas; {{ }} is for Custom Text / Table |
Parameters
| Argument | Description |
|---|---|
checkbox_variable |
The Name of a Checkbox widget whose options have numeric Values. |
When to use sum()
Use sum() when visitors pick multiple priced options from one checkbox list:
| Situation | What sum() does |
|---|---|
| Optional add-ons | Warranty, setup, premium support |
| Configurator extras | Materials, finishes, accessories |
| Service bundles | Several billable tasks selected at once |
Set each checkbox option’s Value to its price or weight. Unselected options are ignored.
Practical examples (ecommerce & leads)
1. Ecommerce add-ons total
Checkbox Name: addons — options like “Extended warranty” (Value 99), “Gift wrap” (Value 5).
| Variable | Formula |
|---|---|
addons_total |
= sum(addons) |
cart_total |
= subtotal + addons_total |
2. Lead gen — selected services
| Variable | Formula |
|---|---|
services_total |
= sum(services) |
estimated_project |
= base_fee + services_total |
Show breakdown in a Table with {{ services_total | currency:2:USD }} in a text cell.
Where to use it
| Location | Supported |
|---|---|
| Result widget Value | Yes — = ... formulas |
| Standalone variable (Variables tab) | Yes |
| Number / other input default Value | Yes, if formula-driven |
| Visibility formula | Yes |
| Custom Text / Table cells | No — use {{ }} templates there, not = functions |
After editing, run Calculate (or enable Run calculation on load in project Options) to refresh results.
Related
- [
if()](/docs/reference/formulas/if-function/) - Understanding Formulas and Variables —
=syntax and variables - Building Your First Calculator — end-to-end quote calculator