Hi,
I have a field in a table with numbers stored as text because some of the records will be entered "<0.1"
How can I remove the "<" and convert to number so I can sum the records?
e.g.
<0.1
<0.1
0.1
Sum = 0.3
You may want to wrap the whole thing in the Nz() function to handle Nulls as zero. Also, I think the Val() function would work as well as CDbl().
My apologies if there's are any typos in the syntax above (once you plug you're own [FieldName] in). I'm only intending it as a pointer toward a solution.
Oh, and if there's always just one character in front of the number, you could probably simplify the above examples a lot. You can use the IsNumeric function to test for a leading "<" or other non-numeric value. For example:
Note that this example would work even if the numeric value was something like "<45 plus some other text"
That's because the Val() function drops any text following the numeric part and returns only the number.
I do believe Val() strips off leading spaces, so even if there was a space between "<" and the number, it should work - although I'm not absolutely certain about that off hand...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.