Recalculating with marinade calc (experimental)¶
Experimental
marinade calc and marinade values are experimental. They sit outside the SemVer
contract that covers the SQLite output: file formats, status names and refusal rules can
change in any release. Do not build a pipeline that cannot absorb that.
An extracted workbook stores results only for the inputs sitting in it, often a single
policy. marinade calc answers a different question: given other input values, what do
the output cells become? It recalculates the workbook with IronCalc,
proves itself against the workbook's own stored values first, and puts a status on
every value it returns. marinade values returns the stored values in the same row shape,
without recalculating.
The rule behind the design: a missing value costs a missing comparison, a wrong value with an "ok" label costs a wrong conclusion. When the calculator cannot vouch for a value, it refuses it and says why.
Install¶
pip install 'xl-marinade[calc]'
marinade values works on the base install. marinade calc needs the extra (it pins
ironcalc==0.9.1); without it the command exits with code 5.
The files in¶
| Option | File | What it holds |
|---|---|---|
WORKBOOK |
.xlsx / .xlsm |
The model, saved by Excel so it carries stored values. |
--policies |
policies.csv |
One row per input set. An id column plus one column per mapped field. UTF-8 (save from Excel as "CSV UTF-8"). Values are read exactly as written, spaces included; ids stay text and lose surrounding spaces, also where the id is mapped to a cell. A blank value (empty or only spaces), a duplicate id, a duplicate column name or a row with more values than the header has names (an unquoted 250,000) is an error, and so is a value under a column with no name. Columns with no name (the empty trailing columns some exports add) are ignored while they are empty, and so are empty values past the last column. |
--map |
map.json |
Which cell or defined name each field sets. |
--outputs |
repeatable | Output cells, ranges or defined names ('Results!B5:B64'). Ranges expand to cells. |
--variables |
vars.json |
Optional. Named output variables for rows.csv. |
--check-against |
check.json |
Optional. Stored results for other input sets, to widen the trust run. |
You must give at least one of --outputs and --variables. A key repeated in the same
object of map.json, vars.json or check.json is an error: JSON would keep only the
last one.
Targets¶
Every cell entry (map.json fields, --outputs, vars.json, and the output and
selector entries of check.json) takes a cell (Inputs!C3), a range
(Proj!C11:C130) or a defined name. The sheet entries of check.json take a sheet
name, in any case. Sheet names and defined names ignore case letter by
letter, as in Excel (Straße and Strasse stay two names), and names may use letters
of any script (Ärger, 税率). A file that defines two names differing only in case,
which Excel itself does not allow, has a target naming them refused as ambiguous.
A name can be defined for the whole workbook or for one sheet only (a sheet copied in
from another workbook often brings its own). Write a sheet's own name as
'Sheet'!Name. A bare name means the workbook's definition; when a sheet defines the
same name too, a bare name is refused as ambiguous, and the error says how to write each.
A whole column or row (Calc!B:B, Calc!3:3, or a name over one) covers the part of it
the sheet uses: up to the last row (or column) that holds a cell. A target that covers
no cells is an error that names it: a name that holds a formula (OFFSET(...) dynamic
ranges included), a constant, a broken reference (#REF!) or cells in another workbook,
and a whole column or row outside the range the sheet uses. Give such a target as a
plain range instead. When several targets are wrong, the error names each of them.
A name whose reference is relative (written without $ on its row or column, such as
Calc!B5 or Calc!$B5) names different cells from each cell that uses it, so it is
refused as a target too.
Inside formulas, names are read the way Excel reads them: a formula reads its own sheet's definition of a name first, and the workbook's only when the sheet has none.
map.json¶
{
"id_field": "policy",
"fields": {"age": "Inputs!C3", "term": "Inputs!C4", "rate": "Rate"}
}
id_field names the policies column that holds the id (default id). It may also appear
in fields, so the id is written into a workbook cell as well. Each target must be a cell
or defined name that holds a constant; mapping onto a formula is an error, and so is
mapping onto any cell of an array formula's range (Excel cannot hold a constant there).
The same holds for a check.json selector. Mapping two fields onto one cell (by
address, by name, or one of each), the id field included, is an error too, since the
cell can hold only one of their values.
A field that no formula can read is an error too: its value would change nothing, and
every policy would get the stored inputs' answer as ok (a map one cell off, on the
label beside the input, is the usual cause). A field counts as read when any formula's
cell or range reference covers its cell, an empty one included, or when a formula reads
it through a defined name in any form Excel resolves (Name, a sheet's own name,
'Sheet'!Name), through a name holding a formula, or inside CELL, INFO or
GETPIVOTDATA. A field is refused only when no read can reach it: where a read cannot be
placed (an OFFSET or INDIRECT landing beyond the cell it lands on with the stored
inputs, a name holding OFFSET or INDIRECT, a name with a relative reference, a 3-D
reference such as S1:S3!B1), every cell it may reach is accepted. A Sheet!Name that
no definition answers is #NAME? in Excel, so it reads nothing. The id field is never
refused, since it may be written into a display cell. A field read only by outputs you
did not request is accepted. run.json records, under
inputs, the cell each field sets and whether a requested output reads it.
Before each input set, every mapped input is reset to its stored value. A value outside the cell's data-validation list refuses that input set's outputs.
Values are converted the way Excel converts what is typed into the cell, by the type of the value the cell holds:
- A number cell takes a plain decimal (
40,-1.5,.5,4e1,0042) or an ISO date (2024-06-30), which becomes its Excel serial (45473). Spaces around it are ignored, as Excel ignores them when it enters a number; other white space, such as the non-breaking space pasted text often carries, is refused by name. - A boolean cell takes
TRUEorFALSE, in any case. - A text cell takes the text as written, spaces included (
" A "is four characters), even when it looks like a number, less one leading apostrophe: Excel's entry prefix, so'123sets the text123. - A cell the workbook saved empty takes an ISO date as its serial,
TRUE/FALSE(any case) as a boolean and a plain decimal as a number; any other text stays text.
On a number cell or an empty one, these are errors that name the policy, the field and what is wrong, rather than a guess:
- spellings Excel reads by the locale's rules:
5%,1,000,1,5,1.234.567,$100,(100),4 000, digits other than 0-9 (٤٠,123), fractions (1 1/2), times and date-times (12:30,3:2,2024-06-30T12:00), and dates not writtenYYYY-MM-DD. Give a plain decimal or an ISO date instead; - a leading apostrophe (
'123): Excel makes the rest text, which a number or empty cell would not hold as calc reads it, so give the value without it; - error values such as
#N/A; - numbers outside the range Excel accepts (
1e-400,1e400); - ISO dates before 1900-03-01. Excel's 1900 date system counts a 29 February 1900 that never was, so its serials before March 1900 are a day off the calendar, and it has no dates before 1900. Give the serial number instead.
A date not written YYYY-MM-DD is text some locale reads as a date: digits joined by
/, - or . whose parts can be a day (1-31), a month (1-12) and a year (one or two
digits, or four from 1900), in day-month-year, month-day-year or year-month-day order
(30/06/2024, 6/30/2024, 30.06.2024, 2024/06/30), or two of them (10-20,
6/2024, 2024-06); or an English month name, in any case, with a day or year
(30-Jun-2024, June 30, 2024, Jun 2024). Other text stays text on an empty cell,
so ids and codes such as 123-45-6789, 1234-5678 or 100-200 written into a blank
display cell are kept as written.
A number cell also refuses any other text (1_000, abc, inf, nan); on an empty
cell those stay text, as in Excel. --check-against table values are set with the type
they are stored with: a table cell holding TRUE sets a boolean.
A number keeps every digit it is written with. Excel keeps 15 significant digits of a
number typed into a cell and turns the rest to zeros (1234567890123456789 becomes
1234567890123450000), so a policy value with more than 15 significant digits (a long
policy number used as a lookup key, or a value written by a script with 17 digits) can
compute differently from Excel typing it. Values set by a macro or a query keep full
precision in Excel too.
The list is the validation's literal items, or the stored values of its source: a range,
a whole column (the cells it holds) or a defined name over cells (the validation sheet's
own name first, as in a formula). As in Excel, the check compares the value as it is
entered in its cell. Items typed into the validation itself ("01,02") are text as
written: they match ignoring case, or by value when the entry is a number. Items read
from cells keep the cells' types: text ignores case, and a number matches number items
only, so 2025-01-01 typed into a date cell matches a list of cells holding that date,
while 1 typed into a number cell does not match a cell holding the text 001. What is
not checked:
- A list fed by a formula (
INDIRECT,OFFSET, a name holding one, as in cascading dropdowns) or by a table column (Table1[Code], or a name over one) is not checked in this version: any value is accepted there. - A list held in formula cells is read from the values the workbook stored, not recomputed for the input set.
- Only list validations are checked. Whole-number, decimal, date, length and custom validations are not.
vars.json¶
{
"premium": {"range": "Proj!C11:C130", "period_start": 0},
"reserve": {"range": "Proj!H11:H130", "period_start": 1},
"npv": {"cell": "Summary!B4"}
}
A range runs down one column or across one row of one sheet; a 2-D range, or a name
whose areas lie on more than one sheet, is an error. A name with several areas on one
sheet runs in row order, whatever order its areas were written in.
period_start is required on every range and has no default, because workbooks differ
on whether periods count from 0 or 1. Periods count from it: the first cell of the range is
period period_start, the next one period_start + 1. A single cell has no period (the
column is empty) and must not carry period_start.
check.json¶
Optional. It names results the workbook already holds for other input sets, such as a batch-results sheet, so the trust run can recalculate those input sets too and compare.
{
"results": {"sheet": "Results", "id_column": "A", "first_row": 2,
"outputs": {"Summary!B13": "C"}},
"inputs": {"table": {"sheet": "Inputs", "id_column": "A", "first_row": 2,
"fields": {"age": "B", "term": "C"}}}
}
results.outputs maps an output cell to the results-sheet column holding its stored value
per input set; two outputs that resolve to one cell are an error. inputs has exactly one
of table (a column per map.json field) or selector (a single cell, e.g.
"Control!C4", that picks the input set by id; it may be a mapped field's cell too). Only
input sets the engine reproduced count towards the exercised paths.
A mismatch (an input set whose recalculated output differs from the stored one by more
than --tolerance) refuses that output only for policies that took the same path to it:
- For the mismatching set, the run records its path to the output: the outcome of every branch and lookup-edge probe upstream of the output.
- A policy whose own outcomes for those probes are all the same gets
check_against_mismatchon that output, and the output isrefused. - If any of those probes is unplaced, or its reading is unsure (for the set or for the policy), the paths count as the same and the output is refused. The rule errs toward refusing.
- An output with no branch or lookup probes upstream has only one path, so a mismatch on it refuses it for every policy.
- A policy on a different path is judged by the usual rules:
okif a matching input set (or the stored inputs) checked its path,unverified_pathif nothing did.
trust_report.json lists every mismatch under check_against.mismatches: the input set
id (input_set), the output (cell), stored, computed, and relative_difference
(measured the way the tolerance is: relative, or absolute below 1).
When you need --check-against¶
When a workbook stores results for only one input set, give --check-against whenever it
holds results for others (a batch-results sheet, a scenario table). Without it, the trust
run sees only the paths the stored inputs take. A lookup that lands in the middle of a
table for a new policy (a different age row, a different year) and a branch the stored
inputs do not take stay unverified, so most new values come back unverified_path.
Measured on lifelib BasicTerm (10,000 model points stored in Batch_Results, selector
Control!C4): with no check set, 100% of new values came back unverified_path; with 200
checked points, 100% came back ok, and all of them were correct.
How a run works¶
- Read the workbook's calculation settings. 1904 dates, precision as displayed or a Strict Open XML file refuse the whole workbook (exit code 6).
- Extract the formula graph into a temporary database, or reuse
--irif it matches the workbook. Give--ira database extracted with 0.8.1 or later: earlier ones trimmed formulas' text results and dropped""results, which the trust run then fails. An older one is refused (exit code 1) with "re-extract with marinade extract". The version checked is the one the extracting install stamped into the database. - Scan the formulas for refused patterns.
- Load a copy with every formula's stored value deleted, so the engine has to compute.
The trust run compares each formula cell with what Excel stored, within
--tolerance(default1e-9, relative or absolute), on the stored inputs and on every--check-againstinput set. - Add probe cells on a hidden sheet that report which branch, lookup row, rounding
input and dynamic reference each input set reaches. Probes go only into cells upstream
of the requested outputs and into the cells a dynamic reference among them can land
on (see Statuses), and never into a cell that is already refused. A probe is
the part of the cell's formula it reports on, lifted onto that sheet so it computes
what the cell computes: references keep their sheet (quoted where Excel needs it,
as for
'2024'), operators keep Excel's precedence (A&B="x"is(A&B)="x"), and under--as-ofTODAY()andNOW()read the as-of date, as the cells do. - For each policy: reset, set the inputs, recalculate, read outputs and probes.
- Walk the graph from each output back to its roots and assign a status.
The extraction database is never written by calc. The run clears its own known output
files from -o at the start (results.csv, rows.csv, paths.csv, trust_report.json,
run.json), so a failed run cannot leave stale ones behind. Nothing else in the directory
is touched. Before clearing anything, the run refuses (exit code 1) an -o that is a file
rather than a directory, and an input file that is one of those output files (the same
name in -o, or the same file through a link): clearing it would delete your input.
The probe cells go on a hidden sheet named _marinade_probes. A workbook that already
has a sheet of that name (in any case) is refused when the run needs probes; rename the
sheet in a copy of the workbook.
The files out¶
All in the -o directory, UTF-8, \n line endings, no timestamps.
| File | Contents |
|---|---|
results.csv |
policy_id, output (Sheet!A1), value, status, reasons. One row per policy and output cell. |
rows.csv |
With --variables: policy, variable, period, value, status, reasons. |
paths.csv |
policy_id, cell, family, kind, ordinal, outcome, exercised. The branch or lookup edge each policy took, in the cells that fed its outputs: through the cells its dynamic references landed on for that policy, not the cell an OFFSET starts from or where it landed with the stored inputs; ordinal tells apart several probes of one kind in one cell; exercised is true when the trust run took it too. |
trust_report.json |
formula_cells, checked, reproduced, share, failures, refused_patterns, settings (with settings.refused), held_external_links, check_against (input_sets, and mismatches with input_set, cell, detail, stored, computed, relative_difference), probes_unplaced (probes that could not be placed, for any reason) and probes_over_cap (those left out only because --probe-cap was reached). |
run.json |
ironcalc_version, marinade_version, workbook_sha256, tolerance, as_of, probe_cap, probes_unplaced, per variable its range, period_start and the cell period 0 falls on, and per map field (inputs) the cell it sets (target) and whether a requested output reads it (read_by_requested_outputs: true, false, or "unknown" when only a read that cannot be placed, as above, may reach it). |
marinade values writes rows.csv and run.json (variables only). Its rows carry status
stored, and the policy is stored, or the stored value of the id field (id_field,
default id) when --map maps it, written as policies.csv would hold it (555,
TRUE), so its rows join calc's rows for the same input set.
In reasons, each entry reads kind@root:detail, joined by ;, in a stable order. The
root is the cell the problem starts at; it can be upstream of the output.
Statuses¶
Every output gets a value. A value can carry several reasons; its status is the most serious.
| Status | Meaning |
|---|---|
refused |
The output depends, through the graph, on a cell that failed the trust run or matches a refused pattern, or a --check-against input set on the same path did not reproduce it. The value is returned for inspection but must not be used. The reason names the root cell. |
uncertain |
The value rests on something implementation-dependent: a rounding function whose input sits within about 1e-12 relative of the point where the result flips, or a comparison or sorted lookup whose two sides are that close (but not equal). A rounding or comparison probe that could not be placed also lands here (not_checked_value). |
unverified_path |
The policy took a branch or lookup position the trust run never exercised, so those formulas were never checked against Excel. A branch or lookup probe that could not be placed also lands here (not_checked_path). |
ok |
None of the above. |
stored |
marinade values only: the workbook's own stored value. |
Details worth knowing:
- Exact whole-number inputs to
INT,TRUNC,ROUNDUP,ROUNDDOWN,CEILINGandFLOORare not uncertain (nothing can flip). Exact halves intoROUNDandMROUNDare. - A comparison whose two sides are exactly equal is decided, not near:
IF(t=0, ...)withtexactly0staysok. Only sides that differ by more than nothing and at most about 1e-12 relative arenear_comparison. The same holds for an approximate lookup whose value equals its matched key. - Branches are
IF,IFS,SWITCH,CHOOSE,IFERRORandIFNA, and anXLOOKUPwith anif_not_foundargument (outcomesfoundandnot_found; the argument counts only when nothing was found). A branch counts as exercised if any cell in the same canonical formula family took it in the trust run. Lookups (VLOOKUP,HLOOKUP,MATCH,LOOKUP,XLOOKUPandXMATCH, in every match and search mode calc accepts) count per family too, but the table's first row, last row and "beyond the end" must each have been hit. ForXLOOKUPandXMATCHfirst and last are positions in the lookup array, whichever way the search runs. - Only evidence that was checked counts. A cell that failed the trust run, or is a
refused pattern, exercises nothing for its family. A branch or lookup inside an arm
the formula did not evaluate (the
FALSEarm of anIFthat wentTRUE) is not exercised by the trust run and is not a path a policy took. A--check-againstinput set exercises only the branches and lookups upstream of the outputs it was compared on, following its own dynamic references: the cells anOFFSETorINDIRECTlanded on for that set count, the cell anOFFSETstarts from and the cell it lands on with the stored inputs do not (unless the set landed there). - Because probes are placed only upstream of the requested outputs, asking for fewer
outputs can make a status more conservative: a family member that is not upstream of
any requested output is not probed, so it cannot vouch for the branches it took. This
holds while every probe fits under
--probe-cap; past it, more outputs means more probes competing for the cap, and a status can become more conservative with more outputs too. - A probe that cannot be placed (cap hit, or inside
LET/LAMBDA/an array context) never yieldsok: a branch or lookup probe givesunverified_path, a rounding or comparison probeuncertain, and a dynamic-reference or number-to-text proberefused. OFFSETandINDIRECTare followed to where they point for each input set; if that cannot be read, the outputs behind it are refused (dynamic reference not checked). So is a range whose end is a call, such asSUM(C5:OFFSET(C5,Term-1,0))orB1:INDIRECT(...): it covers the smallest rectangle holding both ends, read per input set; one whose ends lie on two sheets is refused (Excel gives#VALUE!there). IronCalc 0.9.1 answers#VALUE!for a range ending inINDEX(A1:INDEX(...)) and#ERROR!for one whose start names its sheet (Proj!C5:OFFSET(...)), so the trust run refuses those. The cells that decide where a reference points (OFFSET's rows, columns, height and width, the cellsINDIRECT's text is built from) are precedents of the cell, so a failure or an untried branch there reaches it. AnOFFSETwhose base is a sheet's own (sheet-scoped) name is always refused this way, and a branch, lookup, rounding or comparison on such a name is neverok: the probe sheet cannot read the name as the formula's sheet does. Such anOFFSETbrings no sheet into the landing region below, and a name with a relative reference counts as no fixed cells among the cells that decide where a reference points.- The cells a dynamic reference lands on are checked like cells upstream of an output.
Every formula cell on the sheet an
OFFSETstarts from (or a built range lies on), or that anINDIRECTtext names literally ("Rates!B"&row), is probed, with everything upstream of it, so the trust run and--check-againstinput sets exercise their branches and lookups and a policy landing on an untried arm isunverified_path. These probes count toward--probe-capafter those of the requested outputs. AnINDIRECTwhose text names no sheet ("A"&row, or a sheet name read from a cell) can land anywhere, so its landing cells are not probed: each formula cell it lands on that no probe covers, and each such cell upstream of it, givesnot_checked_path(reached through a dynamic reference, not probed), plus what its own probes give when they cannot be placed (not_checked_valuefor a rounding or comparison,refusedfor a dynamic reference or number-to-text). A landing on a constant needs no check. AnINDIRECTtext that addresses a cell off the grid (row 0, below row 1,048,576 or right of columnXFD) counts as unread: Excel gives#REF!there, while IronCalc 0.9.1 readsRates!B0as 0. - An error code Excel does not have (IronCalc's
#N/IMPL!,#ERROR!,#CIRC!and the like) in an output or in a probe is anengine_errorfor that policy, so the output isrefused, even when anIFERRORaround it would have turned it into a plausible value. Excel's own error codes (#N/A,#DIV/0!,#VALUE!and the rest) are values like any other, with one exception: a#NAME?in an output for a policy, where the trust run had none in that cell, is anengine_error. Excel's#NAME?comes from the formula's text, not its inputs, so one only a new policy reaches is a function the engine lacks on an arm the trust run never took. - Every cell of an array formula's range is a formula cell, whether a legacy
(Ctrl+Shift+Enter) array or a dynamic array that spills. Excel stores the formula on
the range's top-left cell only; calc reads the other cells as computed by it. Each is
compared in the trust run (and counted in
formula_cells), and each carries the formula's status: a refusal, failure or probe that could not be placed (every probe inside an array formula) reaches it and every cell reading it. When a policy makes a dynamic array spill past the range the workbook stored (SEQUENCE(n)with a largern), the cells it spills into carry the formula's status too. - A passing trust run proves only the paths the stored inputs take. That is what
unverified_pathand--check-againstare for.
Reason kinds¶
silently_wrong (engine value differs from Excel's, no error), engine_error,
macro_function, unsupported_function, no_stored_value, refused_pattern,
check_against_mismatch and input_outside_allowed_values give refused.
near_rounding_flip, near_comparison and not_checked_value give uncertain.
unexercised_branch, unexercised_lookup_edge and not_checked_path give
unverified_path. external_link_held is informational and leaves the status ok.
A #NAME? from the engine is macro_function when the cell, or any cell upstream of it,
calls a VBA function (the engine cannot run VBA); the root is that UDF cell, the smallest
one if several feed it. It is unsupported_function only when no UDF is involved: the
engine does not know a function the cell uses.
What ok means, and what it does not¶
ok means every formula and every path behind the value was checked against values Excel
stored: on the stored inputs, or on a --check-against input set that took the same
branches and lookup edges. It does not guarantee that a new input set's value is within
--tolerance of what Excel would compute for it. Floating-point differences between the
engine and Excel are tiny, but cancellation can amplify them: a net figure that is a small
difference of large present values can move by more than 1e-9 relative even when every
formula reproduced. On lifelib BasicTerm_SE one model point's net cash-flow present value
came out at 1.003e-9 relative to Excel's, against the default tolerance of 1e-9. Choose
--tolerance for the outputs you compare, and treat agreement with Excel beyond it as
likely, not proven.
Memory and output size¶
results.csv, paths.csv and rows.csv are written one policy at a time, flushed as each
policy finishes, so memory does not grow with the number of policies. Nor does it grow
with the number of --check-against input sets: each matching set's branch and lookup
outcomes are folded into the exercised set as it finishes and its readings dropped; a
mismatching set keeps only its path to the output it missed. Peak memory is set by the
workbook (the formula graph, the engine's copy of the workbook and the probe plan) and by
the output cells you request: a range is expanded cell by cell, so Calc!B1:B1048576
costs memory for a million cells. A whole column (Calc!B:B) expands only over the rows
the sheet uses.
The files on disk do grow with the policies. paths.csv has one row per policy per
branch or lookup probe it reached, which for an actuarial projection can be over a
thousand rows per policy: about 1.2 million rows and 126 MB for 1,000 lifelib
BasicTerm_S policies. An OFFSET that sums over a projection adds more, since every row
it covers fed the output. Leave room in -o for it.
--probe-cap¶
--probe-cap (default 50,000) bounds the probe cells a run places. A probe left out
because the cap was reached never yields ok (see Statuses), so a run
that hits the cap is more conservative, not wrong. When it happens, probes_over_cap
in trust_report.json counts the probes left out, and marinade calc prints one line
on stderr with the cap that would place them all:
warning: 73006 probes did not fit under --probe-cap 50000, so the values behind them
are not ok; rerun with --probe-cap 123006 to place them all
OFFSET projections use the cap fastest. Every formula cell on the sheet an OFFSET
starts from is probed, with everything upstream of it, so a projection of 3,000 rows by
40 columns needs well over 50,000 probes. Those landing-region probes are planned after
the probes of the requested outputs' own cells, in sheet, row and column order, so the
end of the projection is the first to go past the cap: policies landing late in the
term come back uncertain or unverified_path with not checked reasons. Raise the
cap to the number the warning gives; a larger cap costs memory and run time roughly in
proportion, and paths.csv grows with the probes each policy reaches.
A run that stops part-way (a bad value in policies.csv, for instance) deletes
results.csv, paths.csv and rows.csv, so partial results never look complete.
Refused patterns¶
Some formulas reproduce Excel on the stored inputs only by luck and silently disagree on
the next. They are refused even when the trust run reproduces them. The detail is:
| Detail | What triggers it |
|---|---|
approximate lookup on unsorted column |
VLOOKUP/HLOOKUP/MATCH/LOOKUP in approximate mode over keys that are not sorted, or that are text outside plain a-z, 0-9 and space (Excel's collation differs from a plain sort). Also XLOOKUP/XMATCH with a binary-search mode, or a search mode the scan cannot read. |
approximate lookup on mixed text and numbers |
The key column mixes types. |
approximate lookup on a non-range table |
The table is not a plain reference. |
approximate lookup on whole column |
The table is a whole column or row, or a name over one. IronCalc counts empty cells; Excel skips them. |
implicit intersection on multi-cell name |
A single-cell use of a defined name that covers several cells (a name over a whole column or row always does). |
implicit intersection on multi-cell range |
A multi-cell range used outside a function argument. Ranges inside SUMPRODUCT, MMULT and similar are fine. |
name holds a formula |
A formula reads a defined name whose definition is a formula or a constant rather than cells (the detail text says "formula" for both). IronCalc 0.9.1 rejects such names. |
name with a relative reference: <Name> |
A formula reads a defined name whose reference is relative (no $ on its row or column). Excel reads it relative to the cell using it; IronCalc 0.9.1 reads the stored reference as it is. Also put on a mapped input whose dropdown list is such a name, which refuses everything that input feeds. |
RAND, RANDBETWEEN, RANDARRAY |
Always. |
TODAY, NOW |
Unless --as-of YYYY-MM-DD is given; then they are replaced by that date. |
circular reference |
Always (iterative calculation is noted in the report, not honoured). |
data table |
What-If data tables are removed before loading and their cells refused. |
unparseable formula |
The formula could not be parsed. Error literals typed into a formula, such as #N/A, are a known source of these. |
external reference not held |
The formula reads an external reference the engine copy cannot hold: a range, one with no cached value (IronCalc returns #ERROR! or #REF! for those), or a defined name that points into another workbook. |
approximate lookup on input-dependent keys |
An approximate lookup whose key cells change with a mapped input (an input cell, or a formula that depends on one). The keys may be sorted for the stored inputs and not for the next policy. |
function IronCalc does not implement: NAME |
The formula calls a function the installed IronCalc cannot compute. calc asks the engine about every function the workbook calls, so this covers Excel functions IronCalc 0.9.1 does not have (AGGREGATE, BAHTTEXT, CALL, the CUBE… functions, DBCS, DETECTLANGUAGE, EUROCONVERT, FIELDVALUE, FILTERXML, GETPIVOTDATA, GROUPBY, IMAGE, JIS, PHONETIC, PIVOTBY, REGISTER.ID, RTD, SQL.REQUEST, STOCKHISTORY, TRANSLATE, WEBSERVICE), ones it knows but has not implemented (the FORECAST.ETS family), functions newer than the engine, and VBA and add-in functions (also when Excel lacks them too). The engine answers #NAME? or #N/IMPL!, error values an IFERROR, ISERROR or ISNUMBER around the call would turn into a plausible value. LET and LAMBDA parameters called like functions are not affected; a LAMBDA held in a defined name gets every check in this table through its body, for every cell that calls it. Calls the engine computes only for some arguments are refused by shape: SHEETS with a reference for SHEETS(ref); RANK over a single cell or RANK over a computed reference (also RANK.EQ, RANK.AVG) unless the list is written as a range; NAME over a range for DATEDIF, DATEVALUE, FORMULATEXT, N and UNICODE given a range, a LET or LAMBDA parameter, or an expression over one (a range inside a function that returns one value does not count: SUM, COUNT and the like, INDEX with literal non-zero row and column, or a lookup of one value). Excel computes these cell by cell in an array formula or SUMPRODUCT; the engine answers one #N/IMPL!. |
Some refusals are per policy, read from the probes:
| Detail | What triggers it |
|---|---|
lookup value type differs from keys |
An approximate lookup matches a key of a different type than its lookup value (text against numbers). Excel finds nothing there (#N/A); IronCalc 0.9.1 returns a row. |
number-to-text at a decimal tie |
TEXT, FIXED or DOLLAR rounds a number that sits within about 1e-12 of a tie at the format's decimals: TEXT(1234.5,"#,##0"), TEXT(0.0125,"0.0%"), FIXED(1.005,2). Excel rounds the tie away from zero on the 15-digit value (1,235); IronCalc 0.9.1 rounds the binary value and can land on the other side (1,234). At an exact binary tie FIXED and DOLLAR happen to agree with Excel; they are refused all the same. |
number-to-text of a negative value that rounds to zero or one unit |
TEXT with a one-section format shows a negative number that rounds to zero or to one unit of its last place: TEXT(-0.01,"0%"), TEXT(-1,"0"), TEXT(-0.4,"0"). Excel keeps the minus sign (-1%, -1, -0); IronCalc 0.9.1 drops it. A format with a negative section (0;(0)), FIXED and DOLLAR are not affected. |
number-to-text where Excel's 15-digit text differs |
A number becomes text through &, CONCAT, CONCATENATE, TEXTJOIN or a text function (LEN, LEFT, MID, SUBSTITUTE, EXACT, FIND, VALUETOTEXT, the REGEX functions, TEXTSPLIT and the like), and its text needs more than 15 significant digits (7/12, 0.1+0.2) or the number lies outside 0.0001 to 1e15, where Excel may write scientific notation. Excel writes at most 15 significant digits; IronCalc up to 17. Also TEXT, FIXED or DOLLAR showing more than 15 digits. |
criterion built with & from a non-integer number |
A SUMIF, SUMIFS, COUNTIF, COUNTIFS, AVERAGEIF, AVERAGEIFS, MAXIFS or MINIFS criterion such as "<="&x where x is not a whole number. Excel compares against the 15-digit text it wrote. |
Integers, and decimals with up to 15 significant digits that sit on no tie, stay ok.
TEXT with a date or time format needs no check, and a format's third section (shown
only for an exact zero) does not decide the rounding. A range joined by TEXTJOIN,
CONCAT or CONCATENATE is read cell by cell: constants that are text, booleans,
blanks or numbers Excel writes as the engine does need nothing; formula cells (every
cell of an array formula's range among them, and the empty cells below or right of a
dynamic array that its spill can grow into), mapped inputs and other numbers are read
per policy. Each such cell is probed once, however
many joins read it, and these probes are planned after every other probe, so they
never take --probe-cap room from a branch or lookup check; a join whose cells did not
fit under the cap is refused as number-to-text not checked for its own cell and what
depends on it, nothing else. A function result joined as text (XLOOKUP, INDEX,
IF) is read like a number when it is one value; when it is an array, or the join
names a range with more than 1,000 cells to read, or a sheet's own name or a name with
a relative reference, the join is refused as
number-to-text not checked for the policies that evaluate it, not for those whose
branch skips it.
A conversion calc cannot check at all is refused for every policy as number-to-text
not checked, whatever the policy: a TEXT format that is not literal text, or that
calc cannot read (General, @, scientific, fractions, conditions, first two sections
that round differently); a range given to a text function such as LEN; or a
conversion inside an array formula, LET/LAMBDA, or beyond --probe-cap.
Fixed points¶
| Case | Behaviour |
|---|---|
| External link with a cached single value | Replaced by the cached value. Outputs stay ok, with the reason external_link_held. |
| External link that cannot be held | Refused, see above. |
| 1904 date system | Whole workbook refused. |
| Precision as displayed | Whole workbook refused. |
Strict Open XML (.xlsx saved as "Strict Open XML Spreadsheet") |
Whole workbook refused (strict OOXML). |
| Iterative calculation | Circular cells refused as usual; the report records the setting. |
| Manual calculation mode | Recorded, not refused; stale stored values show as mismatches. |
TODAY, NOW |
Refused unless --as-of. |
Known IronCalc 0.9.1 gaps, each with a synthetic reproduction and the way calc handles
it, are listed in ref/calc/upstream/ in the repository.
Exit codes¶
| Code | Meaning |
|---|---|
| 0 | Success. |
| 1 | Error: bad input file, unknown sheet or name, a target that covers no cells, mapping onto a formula, IR from another workbook or from an extractor older than 0.8.1, an input that is one of the output files, an -o that is a file, a sheet named _marinade_probes, or the engine crashing on a formula (an IronCalc panic, such as on XNPV(1,1); the error names the workbook and the policy or input set, not the cell). |
| 5 | The [calc] extra is not installed. |
| 6 | The workbook is refused outright (1904 dates, precision as displayed, Strict Open XML). trust_report.json and run.json are still written. |
Example¶
marinade calc model.xlsx --policies policies.csv --map map.json \
--outputs 'Summary!B4' --variables vars.json \
--check-against check.json --as-of 2026-01-01 -o out/
marinade values model.xlsx --variables vars.json --map map.json -o stored/
Read trust_report.json first (share, failures), then filter results.csv or
rows.csv on status. Only ok rows can be used as they stand.
See the CLI reference for every option.