min() Function

Pick the smallest of two or more numbers — ideal for discount caps, quantity limits, and budget guardrails in quotes.

formulas functions min

min()

Return the smallest number from a list of values — useful for caps, limits, and “never more than X” rules in quote and lead calculators.


Syntax

Every formula in Calcopolis must start with = in the Value field:

= min(value1, value2, ...)
Part Rule
Function name min — lowercase
Arguments Two or more, separated by commas
Argument types Numbers, variable Names, or expressions
Return value The lowest argument after evaluation

Valid examples

= min(qty, 100)
= min(discount_amount, max_discount)
= min(subtotal * 0.15, 50)
= min(quote_total, competitor_cap)

Invalid / unsupported

Don't write Why
min(qty; 100) Use commas ,, not semicolons
MIN(qty, 100) Function name is lowercase min
min(qty) alone Works but pointless — pass at least two values to compare
{{ min(qty, 100) }} in a Result widget Results use = formulas only — {{ }} is for Custom Text and Table cells

Parameters

Argument Description
value1, value2, … Each value to compare. Literal, variable, or expression.
(two or more) Pass at least two values; min returns the smallest after evaluation.

When to use min()

Use min() when a calculated amount must not exceed a ceiling:

Situation What min() does
Discount cap Promo is 15% of subtotal, but never more than $50
Quantity limit Bill at most 100 units at the promo rate
Stock / capacity Quote quantity cannot exceed available stock
Budget guardrail Show the lower of your quote and the visitor’s stated budget
Tier comparison Pick the cheaper of two pricing paths

min() answers: “What is the lower of these numbers?”
For a floor (never below zero), use [max()](/docs/reference/formulas/max-function/) — e.g. = max(0, balance).


Practical examples (ecommerce & leads)

1. Cap a percentage discount

Variable Formula
discount_raw = subtotal * 0.15
discount_applied = min(discount_raw, 50)
you_pay = subtotal - discount_applied

Display discount_applied on a Result widget.

2. Bulk order — limit promo quantity

Variable Formula
promo_qty = min(qty, 100)
promo_line = promo_qty * promo_unit_price

3. Quote vs. visitor budget

Variable Formula
feasible_total = min(quote_total, stated_budget)

stated_budget from a Number field on a lead form.

4. Partial fulfillment when stock is limited

Variable Formula
qty_fulfilled = min(qty_requested, stock_available)
line_total = qty_fulfilled * unit_price

5. Clamp between zero and a maximum

= max(0, min(setup_fee, max_setup_fee))

max(0, …) prevents negatives; min(…, max_setup_fee) enforces the ceiling.


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.


← Back to Reference

Still have unanswered questions?

We are here to help. Reach out and our team will get back to you.

Contact support