Skip to contentSheetwrite

Formulas

Excel functions, calculated live

Pick a family of Excel functions added in 0.7.0, change an input, and watch each result recalculate. Column F reads every formula back with FORMULATEXT.

Engine @sheetwrite/formulas

Families
8
Functions shown
41
Try it
  1. Pick a family
    Family
    Base conversion, bits, complex numbers, Bessel functions and units.
  2. Change number in B2
    DEC2HEX reads it: …

Where they run

  • Engineering, financial, the Excel 2007 statistics names, byte-width text functions (LENB, LEFTB and the rest) and GETPIVOTDATA run in the full engine, @sheetwrite/formulas.
  • LOOKUP, TRIMRANGE, the information functions and the new math functions run in both engines.
  • A reference to another workbook keeps its text and reads the values saved for its link. Update Values asks your app for the linked workbook's current values; a link with no saved values shows #REF!.
Where the functions runThe full engine, @sheetwrite/formulas, contains everything in the default engine, @sheetwrite/wasm. LOOKUP, TRIMRANGE, the information functions and the new math functions run in both. Engineering, financial, the Excel 2007 statistics names, byte text and GETPIVOTDATA run in the full engine only.Both engines@sheetwrite/wasmLOOKUP, TRIMRANGE,information, new mathFull engine only@sheetwrite/formulasEngineering, finance, Excel 2007statistics, byte text, GETPIVOTDATA
Where the functions runThe full engine, @sheetwrite/formulas, contains everything in the default engine, @sheetwrite/wasm. LOOKUP, TRIMRANGE, the information functions and the new math functions run in both. Engineering, financial, the Excel 2007 statistics names, byte text and GETPIVOTDATA run in the full engine only.Both engines@sheetwrite/wasmLOOKUP, TRIMRANGE,information, new mathFull engine only@sheetwrite/formulasEngineering, finance, Excel 2007statistics, byte text, GETPIVOTDATA

The full engine contains everything in the default engine.

The code behind it

functions.ts
import "@sheetwrite/core/styles.css";
import { createGrid, initSheetwrite, type Workbook } from "@sheetwrite/core";
import * as formulas from "@sheetwrite/formulas";
// An "engineering" sheet with a distance in kilometres in B3
declare const workbook: Workbook;
// The full engine runs every family on this page
// The grid fills its host, so the host needs a height
const host = document.querySelector<HTMLElement>("#grid");
if (host === null) throw new Error("Missing #grid host");
host.style.height = "480px";
const grid = createGrid(host, { workbook });
// A formula is a cell value; the result is read back after the recalculation
const result = { sheet: "engineering", row: 4, col: 4 };
patches: [{ op: "set", addr: result, value: { kind: "formula", src: '=CONVERT(B3,"km","mi")' } }],
});
console.info(grid.store.getCell(result).resolved);
// When the page removes the host: grid.destroy();