Tabular IQ
Back to Function Index

VAL()

Overview

VAL() converts a character expression to a numeric value. This function is the opposite of STR(), which converts numbers to strings. VAL() processes the string from left to right, converting numeric characters until it encounters a non-numeric character. If it encounters a non-numeric character before finding any numbers, it returns 0.

Function Format

VAL(string)

Return Value

VAL() returns a numeric value

Examples


// Basic numeric conversion
VAL("12.085") = 12.085

// Negative number conversion
VAL("-10") = -10

// Conversion with trailing non-numeric
VAL("5548A") = 5548

// Conversion with multiple non-numeric
VAL("5548A-12345") = 5548

// Non-numeric at start
VAL("A-5548-12345") = 0

// Additional examples
VAL("123.45") = 123.45        // Decimal number
VAL("0.001") = 0.001         // Small decimal
VAL("1000") = 1000           // Integer
VAL("1E3") = 1000            // Scientific notation

Notes

  • Important behaviors:
    • Stops at first non-numeric character
    • Returns 0 if no numbers found
    • Handles decimal points
    • Preserves negative signs
    • Processes left to right
  • Common use cases include:
    • String to number conversion
    • Data type conversion
    • Input validation
    • Data cleaning
    • Numeric extraction
  • The function is useful for:
    • Parsing numeric data
    • Data type conversion
    • Input processing
    • Data validation
  • Important considerations:
    • Opposite of STR() function
    • Strict numeric conversion
    • No rounding occurs
    • Handles scientific notation

See Also