Number.ToText
NumberConverts a number to a text string, with optional format specifier and culture for locale-aware formatting.
Syntax
Number.ToText(number as nullable number, optional format as nullable text, optional culture as nullable text) as nullable textParameters
| Name | Type | Required | Description |
|---|---|---|---|
number | number | Yes | The number to convert to text. |
format | text | No | An optional .NET format specifier such as "D" (decimal integer), "F2" (fixed 2 decimal places), "P" (percentage), "E" (scientific), "C" (currency), or "G" (general). |
culture | text | No | An optional culture string (e.g., "en-US", "de-DE") that controls locale-specific formatting such as decimal and thousand separators. |
Return Value
text — A text representation of the number, formatted according to the optional format and culture.
Remarks
Number.ToText converts a number to a text string with optional format and culture control. When called with no format argument, it returns a compact general representation (similar to "G"). The format parameter follows .NET standard numeric format specifiers with an optional precision digit:
| Format | Name | Example |
|--------|------|---------|
| "G" | General | "3.14159" |
| "F" / "F2" | Fixed-point | "3.14" |
| "N" / "N2" | Number with thousands separators | "1,234.56" |
| "P" / "P1" | Percentage | "87.5%" |
| "E" / "E2" | Scientific notation | "3.14E+002" |
| "C" / "C2" | Currency (symbol depends on culture) | "$3.14" |
| "D" | Decimal integer (no fractions) | "42" |
The culture parameter controls locale-specific output: "de-DE" produces "1.234,56" for "N2" format, while "en-US" produces "1,234.56". Always specify the culture explicitly for user-facing output that must be locale-consistent.
Note that Number.ToText operates only on numbers. To convert other types to text, use Text.From.
Examples
Example 2: Format a ratio as a percentage with 1 decimal place
Number.ToText(0.8753, "P1")Result | |
|---|---|
| 1 | 87.5% |
Example 3: Format unit prices with thousands separators and 2 decimal places
Table.AddColumn(
Table.SelectColumns(Table.FirstN(Sales, 4), {"OrderID", "CustomerName", "UnitPrice"}),
"DisplayPrice",
each Number.ToText([UnitPrice], "N2", "en-US"),
type text
)OrderID | CustomerName | UnitPrice | DisplayPrice | |
|---|---|---|---|---|
| 1 | 1 | Alice | 25 | 25.00 |
| 2 | 2 | Bob | 50 | 50.00 |
| 3 | 3 | Charlie | 15 | 15.00 |
| 4 | 4 | Alice | 75 | 75.00 |