Extract a numeric value from a string.

      Val ( String )

   String   A string expression.

Val() will stop reading the string at the first non-numeric character. This does not include spaces.

The Val() function can be used in VBA or in an SQL query.


Dim intHouseNo as Integer
intHouseNo = Val ("12 Acacia Gardens")
returns: 12

“A worker may be the hammer’s master, but the hammer still prevails. A tool knows exactly how it is meant to be handled, while the user of the tool can only have an approximate idea” ~ Milan Kundera


Mid - Extract a substring from a string.

Copyright © 1999-2024
Some rights reserved