Skip to main content

Use Val function to convert text values to numbers

Hello friends foxcarolina, on this occasion the admin wants to share an article entitled Use Val function to convert text values to numbers , we have made good, quality and useful articles for you to read and take information in. hopefully the post content is about which we write you can understand. Alright, happy reading.

Use Val function to convert text values to numbers

The Val() function can pull out any text (string) data from a field that has a mixture of both text and numbers, and return just the numeric values.

For example, in a field that stores mileage information field as, 30 miles but you want to pull out the numeric data, you would use Val ("fieldname") like this:

Val ("mileage")

The Val() function stops reading a string as soon as it comes across a character that it doesn't recognize as a number so, symbols and characters such as dollar signs and commas, which are often considered as parts of numeric values are not recognized.

Note:  The only valid decimal separator recognized by the Val() function is the period (.). If you use a different decimal separator, as some international applications do, use the CDbl function instead.

Another way to use for the Val() function is when querying on two tables. For example, in Table 1 the ID number is stored as a text field and in Table 2 it is stored as a number field in the second table. In order to connect and query both tables, the data types needs to be similar. So, you'd use the VAL() function, to convert the ID field in Table 1 like this:

ConvertedID: Val([FieldName]) 

You can use the Val function in an expression. If you are not familiar with expressions, see how to create expressions or you can read more about adding functions to expressions.

For more information about functions see the help for built-in functions, properties, macro actions, and SQL keywords.



That's the article: Use Val function to convert text values to numbers
Thank you for visiting my blog, hopefully it can be useful for all of you. Don't forget to share this article with your friends so they also know the interesting info, see you in other article posts.

You are now reading the article Use Val function to convert text values to numbers with link address https://foxcarolinaa.blogspot.com/2016/12/use-val-function-to-convert-text-values.html

More Articles

Comment Policy: Silahkan tuliskan komentar Anda yang sesuai dengan topik postingan halaman ini. Komentar yang berisi tautan tidak akan ditampilkan sebelum disetujui.
Buka Komentar
Tutup Komentar