Number.FromText

Number

Converts a text representation of a number to a number value, with optional locale-aware parsing.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Number.FromText(text as nullable text, optional culture as nullable text) as nullable number

Parameters

NameTypeRequiredDescription
texttextYesThe text string to convert to a number.
culturetextNoAn optional culture string (e.g., "en-US", "de-DE") that controls how decimal and thousand separators are interpreted.

Return Value

numberThe numeric value represented by the text string.

Remarks

Number.FromText parses a text value into a number. It recognizes integers, decimal numbers, and scientific notation (e.g., "1.5e3" → 1500). It also recognizes the special strings "NaN", "Infinity", and "-Infinity". When no culture is specified, the engine uses the session locale.

The most important use of the optional culture parameter is handling locale-specific decimal and thousands separators. In "en-US", the decimal separator is . and the thousands separator is , (e.g., "1,234.56"). In "de-DE" (German) and many European locales, these are reversed: . is the thousands separator and , is the decimal (e.g., "1.234,56"). Failing to specify the correct culture will cause parsing errors or silently incorrect values.

Number.FromText raises an error if the text cannot be parsed as a number. Use try Number.FromText(text) otherwise null to safely handle unparseable values in bulk conversions. For simple type conversion without locale concerns, Number.From(value) is a more concise alternative that handles the same cases plus non-text inputs.

Examples

Example 1: Parse a decimal string in the default locale

Result
Result
13.14

Example 2: Parse a German-formatted number with culture

Number.FromText("1.234,56", "de-DE")
Result
Result
11,234.56

Example 3: Safely parse a text column that may contain non-numeric values

let
    Data = #table({"ID", "PriceText"}, {{1, "25.00"}, {2, "N/A"}, {3, "75.50"}}),
    WithParsed = Table.AddColumn(
        Data,
        "Price",
        each try Number.FromText([PriceText]) otherwise null,
        type number
    )
in
    WithParsed
Applied Steps

The final output — the table with a parsed Price column where unparseable text produces null rather than an error.

ID
PriceText
Price
1125.0025
22N/Anull
3375.5075.50

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks