Converts a text string that represents a number to a number in a locale-independent way. Handles different decimal and group separators. Essential for international data conversion and locale-independent number parsing in Excel.
Master the fundamentals of Excel NUMBERVALUE function
The NUMBERVALUE function converts text strings to numbers with support for locale-specific decimal and group separators. Unlike VALUE, NUMBERVALUE allows you to specify custom separators, making it essential for international data conversion, handling different number formats, and locale-independent number parsing.
Handles different decimal/group separators
Specify decimal and group separators
Handles European, US, and other formats
More flexible than VALUE function
Function-specific parameters
Function-specific return type
Convert numbers from different locales
Import and convert formatted numbers
Convert between number formats
Parse numbers from formatted text
Exact matching required
Returns numeric position
Handles missing text gracefully
=NUMBERVALUE(text, decimal_separator, group_separator)The text string to convert to a number
The character used to separate the integer and fractional part of the result. Defaults to period (.) if omitted.
The character used to separate groupings of numbers (thousands). Defaults to comma (,) if omitted.
Numeric value
Description: Converts text string to number with locale-specific decimal and group separators
Convert text number to numeric
Converts text string to number with default separators
Simple VBA implementation of NUMBERVALUE function
' Basic NUMBERVALUE in VBA
Range("B1").Value = Application.WorksheetFunction.NumberValue(Range("A1").Value)
' Using VBA NumberValue function
Dim textValue As String
textValue = "123.45"
Dim numValue As Double
numValue = Application.WorksheetFunction.NumberValue(textValue)
Debug.Print numValue ' Output: 123.45
' Convert European format
Sub ConvertEuropeanFormat()
Dim cell As Range
For Each cell In Range("A1:A10")
If Not IsEmpty(cell.Value) Then
On Error Resume Next
Dim numValue As Double
numValue = Application.WorksheetFunction.NumberValue(cell.Value, ",", ".")
If Err.Number = 0 Then
cell.Offset(0, 1).Value = numValue
Else
Err.Clear
End If
On Error GoTo 0
End If
Next cell
End SubHandle multiple number formats
' Function to detect and convert number format
Function SmartNumberValue(text As String) As Variant
On Error Resume Next
' Try US format first
Dim result As Double
result = Application.WorksheetFunction.NumberValue(text, ".", ",")
If Err.Number = 0 Then
SmartNumberValue = result
Exit Function
End If
Err.Clear
' Try European format
result = Application.WorksheetFunction.NumberValue(text, ",", ".")
If Err.Number = 0 Then
SmartNumberValue = result
Exit Function
End If
Err.Clear
' Try space as group separator
result = Application.WorksheetFunction.NumberValue(text, ".", " ")
If Err.Number = 0 Then
SmartNumberValue = result
Exit Function
End If
SmartNumberValue = "#VALUE!"
On Error GoTo 0
End Function
' Convert range with auto-detection
Sub ConvertRangeAutoFormat()
Dim cell As Range
For Each cell In Range("A1:A100")
If Not IsEmpty(cell.Value) Then
cell.Offset(0, 1).Value = SmartNumberValue(CStr(cell.Value))
End If
Next cell
End SubConvert numbers from different locales
Handle European number format
Import and convert formatted numbers
Convert between number formats
NUMBERVALUE returns #VALUE! when text cannot be converted
=IFERROR(NUMBERVALUE(A1, ",", "."), 0)Solution: Ensure text contains valid numeric characters and separators match the format. Use IFERROR to handle: =IFERROR(NUMBERVALUE(A1, ",", "."), 0)
Incorrect separator specification causes conversion errors
=NUMBERVALUE("1.234,56", ",", ".")Solution: Verify separator order: NUMBERVALUE(text, decimal_separator, group_separator). European: (",", "."), US: (".", ",")
Spaces in text may cause conversion issues
=NUMBERVALUE(TRIM(A1), ",", ".")Solution: Use TRIM to remove spaces: =NUMBERVALUE(TRIM(A1), ",", ".")
NUMBERVALUE with empty cell returns #VALUE!
=IF(A1="", "", NUMBERVALUE(A1))Solution: Check for empty cells: =IF(A1="", "", NUMBERVALUE(A1))