Using Tables in Formulas

Using Tables in Formulas

Overview

The TABLE() function lets you look up values from your pricing tables directly inside calculator pricing formulas. Instead of writing complex conditional logic, you pass in the table name and one or two keys, and the function returns the matching value. This keeps your formulas clean and your pricing data easy to maintain separately. You can use TABLE() in any formula field throughout Calculator Editor → Options & Pricing.

Quick Reference

Syntax Description
TABLE("name", key) 1D lookup — returns the value for the matching key.
TABLE("name", rowKey, colKey) 2D lookup — returns the value at the intersection of the row and column keys.
TABLE("name", rowKey, colKey, "mode") 2D lookup with explicit mode override.

1D Lookup (one key)

TABLE("tableName", key)

tableName is the exact name of your pricing table (in quotes). key is the value to look up — a literal value or an option reference like OPT("MATERIAL") or INPUT("WIDTH").

2D Lookup (two keys)

TABLE("tableName", rowKey, colKey)

rowKey matches against the table's row keys. colKey matches against the column keys.

Lookup Modes

The lookup mode controls how keys are matched. Each table has a default mode set when you create it, but you can override it per-call by passing a fourth argument: TABLE("name", rowKey, colKey, "interpolate").

Mode Value Behavior
Exact match "exact" Returns the value only when the key matches exactly.
Nearest lower "nearestLower" Finds the closest key that is less than or equal to the input.
Nearest upper "nearestUpper" Finds the closest key that is greater than or equal to the input.
Nearest "nearest" Finds the closest key in either direction.
Interpolate "interpolate" Linearly interpolates between the two nearest keys. Numeric keys only.

Details

  • The returned value is a number, so you can combine it with arithmetic: TABLE("materials", OPT("MATERIAL")) * VAR("AREA").
  • Pass option references as keys so the lookup is dynamic based on customer selections.
  • Make sure the pricing table exists on the Pricing Tables page and has data before referencing it in a formula.
  • You can reference both per-calculator tables (created in the calculator editor) and global tables (created on the main Pricing Tables page).

Examples

  • Material cost formula — Your calculator has a dropdown option called MATERIAL. Your formula is TABLE("materials", OPT("MATERIAL")) * INPUT("QUANTITY"). When a customer selects "Acrylic," the function looks up the acrylic price and multiplies it by the quantity.
  • Size-based sheet pricing — Your calculator has WIDTH and HEIGHT number inputs. Your formula is TABLE("sheet_prices", INPUT("WIDTH"), INPUT("HEIGHT")). The 2D table returns the price for the selected width and height combination. With interpolation mode, non-standard sizes get a calculated price between the nearest table entries.
  • Nearest-lower rate lookup — You have a 1D table of quantity breaks (10, 25, 50, 100) mapped to per-unit rates. Your formula is TABLE("qty_rates", INPUT("QTY"), "nearestLower"). A customer entering 30 units gets the rate for 25 (the nearest key ≤ 30).
    • Related Articles

    • Pricing Tables

      Overview Pricing tables are reusable lookup tables that store pricing data outside of your calculator formulas. Instead of hardcoding prices or building complex nested conditions, you define your data in a table and reference it from any calculator's ...
    • Pricing Variables

      Overview Pricing variables are named, computed values that act as intermediate steps in your pricing logic. Instead of writing one large formula, you can break the calculation into smaller, readable pieces — each stored as a variable — and reference ...
    • Price Adjustments

      Overview Price adjustments are conditional rules that modify the calculated price when certain conditions are met. Each adjustment combines one or more conditions with a formula, letting you add surcharges, apply multipliers, or set overrides based ...
    • Weight Calculation

      Overview Weight calculation lets you define a formula that computes a product's shipping weight based on customer selections. The calculated weight is saved with the order so your shipping provider can use it to quote accurate rates. You configure it ...
    • How Pricing Works

      Overview Calculator AI uses a multi-stage pricing pipeline to turn customer selections into a final price. Each stage feeds into the next, so you can build pricing as simple or as complex as your product requires — from a flat price to formulas that ...