Skip to content

formatNumber

On this page

Format a numeric value using an Excel number format string or format index.

This is the main entry point for the SSF engine. It resolves the format string (from index or direct string), selects the appropriate section for the value's sign, and delegates to the tokenizer/renderer (eval_fmt).

formatNumber(fmt: string | number, value: any, options?: any): string

Parameters

NameTypeRequiredDescription
fmtstring | numberYesFormat string (e.g. "#,##0.00") or format index (e.g. 14 for "m/d/yy")
valueanyYesThe value to format (number, string, boolean, Date, etc.)
optionsanyNoFormatting options: date1904, dateNF (date format override), table (custom format table)

Returns

string

Formatted string representation