Formulas dynamic content lets you perform calculations and data transformations directly within Matik — no external spreadsheet or custom SQL needed. Use formulas to compute metrics, format numbers, pivot data, apply conditional logic, and more, all while referencing data from any of your existing dynamic content or inputs.
Because formulas run natively in Matik, they also offer faster generation performance compared to routing transformations through an external data source.
What You Can Do with Formulas
Formulas are designed to help you transform your data into the format you need to present it in your templates. Here are some common use cases:
Calculate metrics from existing data
If you already have {{active_users}} and {{total_seats}} as dynamic content, you can create a formula to compute the adoption rate:
{{active_users}} / {{total_seats}} * 100Format numbers for presentation
Your data source might return {{revenue}} as a raw number like 1540000. Use a formula to present it in currency format:
FORMAT({{revenue}}, "USD")This returns $1,540,000.00. You can also format as a percentage, integer, or custom pattern:
FORMAT({{conversion_rate}}, "percent")Pivot and reshape table data
Suppose {{deals_by_rep}} returns a table of individual deal rows with columns for Rep Name, Quarter, and Deal Amount. You can pivot it into a summary table grouped by rep and broken out by quarter:
PIVOT(SLICE({{deals_by_rep}}, "1:", ":"), 0, 1, 2, "sum")This slices off the header row first, then pivots using column 0 (Rep Name) as the row grouping, column 1 (Quarter) as the column grouping, and column 2 (Deal Amount) as the value, aggregated by sum.
Apply conditional logic
Return different text based on how a metric compares to a baseline. For example, if {{nps_score}} and &:target_nps are available:
IF({{nps_score}} >= &:target_nps, "On Track", "Needs Attention")Filter and sort table data
If {{support_tickets}} returns a table with columns for Account, Priority, and Status, you can filter to just the high-priority open tickets and sort by account:
SORT(FILTER(SLICE({{support_tickets}}, "1:", ":"), 1, "=", "High"), 0, "asc")Referencing Data in Formulas
Formulas work with data from your existing dynamic content and inputs:
-
Dynamic content references use double curly braces:
{{dynamic_content_name}}. These pull in the resolved value of another piece of dynamic content — whether it returns text, a number, or a table. Examples:{{revenue}},{{quarterly_results}},{{account_name}}. -
Input references use the ampersand-colon prefix:
&:input_name. These pull in the value of an input parameter that the end user provides at generation time. Examples:&:account_name,&:fiscal_year,&:target_quota.
You can use both types together in a single formula. For instance:
IF({{closed_won_amount}} >= &:quarterly_target, "Target Met", "Below Target")Output Types
Formulas support four output types:
- Text: Returns a single value — a number, formatted string, or text. Use this for calculated metrics, formatted numbers, conditional labels, or concatenated strings.
- Table: Returns a table of data (rows and columns). Use this when your formula produces a filtered, pivoted, sorted, or otherwise transformed dataset. When using the Table output type, you can optionally specify comma-separated column headers.
- Image: Returns an image. Use this to choose an image based on your data, for example a green, yellow, or red status dot based on an account's health score. See Working with Images in Dynamic Content.
- Recipients: Returns the recipients for a Matik Mail template. Available when your account has Matik Mail. See Creating Sender, CC: & BCC: Dynamic Content.
Editing Formulas
You can compose a Formula yourself, or let Matik's AI draft it for you.
When editing or composing a Formula yourself, you can leverage:
- The function explorer, to browse Matik's supported functions and their expected syntax
- Autocomplete, to easily fill in functions as you type.
Working with Tables
Many formula functions operate on table data. Here are some important things to know:
-
Headers are row 0. When a dynamic content reference returns a table, the first row (index 0) typically contains column headers. Most functions like FILTER, PIVOT, COUNTIF, SUMIF, and AVGIF operate on data rows, so you should slice off the header row first using
SLICE({{table}}, "1:", ":")before passing the data to these functions. -
Column indices are 0-based. The first column is 0, the second is 1, and so on. For example, to filter on the third column, use column index
2. -
You can use SLICE for flexible data access. SLICE supports Python-style indexing:
"1:"means "from row 1 onward,"":3"means "up to row 3,""1:5"means "rows 1 through 4," and-1means "the last row." The same patterns apply to columns.
Converting Spreadsheet Dynamic Content to a Formula
The Matik AI Agent can convert Google Sheets or Excel dynamic content into a Formula. The agent writes the Formula, tests it against the spreadsheet on several sets of input values, and saves it only if every set returns the same result. You choose whether to:
- Replace the existing dynamic content. It becomes a Formula as a new version, with the same name, output type, and inputs, so templates that use it keep working. You can restore the spreadsheet version from Version History.
- Create new dynamic content. The spreadsheet dynamic content doesn't change, and your templates keep using it until you update their tags.
Good candidates for conversion
Convert spreadsheet dynamic content that only calculates or reshapes data. The Formula returns the same result without opening the spreadsheet on every generation, so it generates faster, doesn't need access to the sheet, and its logic is visible in Matik. For example:
- Calculators: A sheet that takes inputs such as a seat count or discount and returns a total, like a pricing calculator.
-
Summaries of other dynamic content: A sheet that totals, averages, counts, filters, or sorts a table passed in from other dynamic content, using functions like
SUM,AVERAGE,SUMIFS,COUNTIFS,FILTER, andSORT. -
Lookups: A sheet that uses
VLOOKUPorINDEX/MATCHto look up values in a table passed in from other dynamic content.
Limitations
- Size: The output range can be up to 200 cells, and it can depend on up to 500 cells in the sheet.
- Tables typed into the sheet: If your sheet looks up values in a table typed directly into it, such as a rate card, the agent asks how to handle it before converting. It can copy the values into the Formula, which then won't pick up later edits to that table, or move the table into its own dynamic content so the Formula stays in sync with it. Tables larger than 200 cells must be moved.
- Unsupported functions: Matik Formula supports fewer functions than Google Sheets or Excel. If the cells behind your output use a function with no Matik Formula equivalent, the agent tells you which function and cells are blocking the conversion. Unsupported functions include:
| Category | Not supported |
|---|---|
| Logic |
AND, OR, NOT, IFS, IFERROR
|
| Math |
ROUND, ROUNDUP, ROUNDDOWN, ABS, POWER, and the ^ operator |
| Text |
LEFT, RIGHT, MID, LEN, SUBSTITUTE, TEXT, VALUE, and the & operator |
| Dates |
DATE, YEAR, MONTH, DAY, EOMONTH, DATEDIF
|
| Lookups |
XLOOKUP, and VLOOKUP, HLOOKUP, INDEX, or MATCH over a range the sheet calculates with its own formulas |
| Dynamic ranges |
ARRAYFORMULA, QUERY, INDIRECT, OFFSET
|
| Changing values |
NOW, RAND, RANDBETWEEN
|
| Other workbooks | IMPORTRANGE |
| Sheet structure | Circular references |
Comments
0 comments
Article is closed for comments.