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) One-column lookup — returns the value for the matching key. Works for key→value tables and single-column grids.
TABLE("name", key, "Price") Same lookup with an explicit column key (use your value-column header if it is not Price).
TABLE("name", rowKey, colKey) Multi-column lookup — returns the value at the intersection of the row and column keys.
TABLE("name", rowKey, colKey, "mode") Lookup with an explicit mode override as the fourth argument.

One-column lookup (key → value)

TABLE("tableName", key)

tableName is the name of your pricing table (in quotes). Capitalization does not matter — TABLE("pricing", …) finds a table named Pricing. key matches the values in the blue column of the grid.

For one-column tables you can omit the column key. Appify uses the sole non-empty green header in the value column (commonly Price). You may also pass it explicitly:

TABLE("tableName", key, "Price")

Grid layout

           | Price
-----------+-------
WOOD       | 2.50
ACRYLIC    | 4.00
METAL      | 6.50
  • Blue column = Choice Token lookup keys (match OPT_TOKEN / HAS, not display labels)
  • Green header of the value column (Price) = TABLE column key
  • Top-left cell = optional label (not a lookup key)

Multi-column lookup (two keys)

TABLE("tableName", rowKey, colKey)

rowKey matches the blue column. colKey matches a green header-row column key. Either key can be numeric (INPUT) or a Choice Token (OPT_TOKEN).

Grid layout

     | VINYL | PAPER
-----+-------+------
12   | 10    | 8
24   | 18    | 14
  • Blue column = row keys (here: numeric sizes)
  • Green header row = column keys (here: material Choice Tokens)
  • Formula: TABLE("sheet_prices", INPUT("SIZE"), OPT_TOKEN("MATERIAL"))

Lookup Modes

The lookup mode controls how keys are matched. Each table has a default mode set when you create it. You can override it per call by passing a fourth argument:

TABLE("name", rowKey, colKey, "nearestLower")

For one-column tables with an explicit column key:

TABLE("qty_rates", OPT("QTY"), "Price", "nearestLower")
Mode Value Behavior
Exact match "exact" Returns the value only when the key matches a row / column key. Numbers match by value even when the header was typed as text (10, 10.0, and 10 all match a quantity of 10); text keys ignore case and surrounding spaces.
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" Blends between surrounding numeric keys (clamped at edges). One-column / pair tables interpolate along the key axis. Multi-column numeric grids use bilinear interpolation. With named columns, the column is matched exactly and values interpolate along rows.

Preferred: put the mode in the fourth argument.
Compatibility: on one-column / key→value tables, TABLE("qty_rates", OPT("QTY"), "nearestLower") is also accepted (the mode-shaped third argument is treated as a mode override). On multi-column grids the third argument is always a column key, so use the four-argument form.

Details

  • The returned value is a number, so you can combine it with arithmetic: TABLE("materials", OPT_TOKEN("MATERIAL")) * VAR("AREA").
  • For dropdown/radio/button/swatch lookups, pass OPT_TOKEN("KEY") and put Choice Tokens (not labels) in the table as lookup keys — the blue column (one-column keys or multi-column row keys) and/or the green header row (multi-column column keys). OPT("KEY") is the option's numeric price contribution, not the selected choice name. String key matching is case-insensitive (one matches ONE).
  • 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).
  • Multi-column tables require both rowKey and colKey. Omitting colKey only works when the table has exactly one value column.
  • Mixing key types is fine: a grid with Choice Tokens down the blue column (2X2, 4X4) and quantities across the green header row (10, 25, 50) works in every mode, including Exact — TABLE("PRICING", OPT_TOKEN("SIZE"), OPT("QUANTITY")).

Examples

  • Material cost formula — Your calculator has a dropdown option called MATERIAL. Your table has Choice Token keys WOOD / ACRYLIC / METAL in the blue column and a Price column. Your formula is TABLE("materials", OPT_TOKEN("MATERIAL")) * OPT("QUANTITY"). When a customer selects Acrylic (ACRYLIC), the function looks up that rate and multiplies it by the quantity.
  • Size × material sheet pricing — Your calculator has a numeric SIZE input and a MATERIAL dropdown. Green header columns use material Choice Tokens (VINYL, PAPER). Your formula is TABLE("sheet_prices", INPUT("SIZE"), OPT_TOKEN("MATERIAL")).
  • Size-based sheet pricing — Your calculator has WIDTH and HEIGHT number inputs. Your formula is TABLE("sheet_prices", INPUT("WIDTH"), INPUT("HEIGHT")). With Interpolate mode, non-standard sizes get a blended price between the nearest table entries.
  • Nearest-lower rate lookup — You have a one-column table of quantity breaks (10, 25, 50, 100) mapped to per-unit rates under a Price header. Your formula is TABLE("qty_rates", OPT("QTY"), "Price", "nearestLower"). A customer entering 30 units gets the rate for 25 (the nearest key ≤ 30). If the table has only that one value column, TABLE("qty_rates", OPT("QTY")) also works when the table mode is already Nearest lower.