parsing text field with numbers

J

Jeannie

I have a field that has numbers and occasionally a letter amended:
1
2
3
3a
30
300
4
5a
5b
6
I need to parse the field ,extracting the numbers. In the end, I would like
to sort the field numerically.

How can I parse based on the difference between numbers and text?
 
A

Allen Browne

If:
a) the numbers are always the leading characters, and
b) there are no nulls,
you can just type an expression like this into the Field row in query
design:
Val([F1])
substituting your field name for F1.

You can then filter or sort on the numeric values.
 
J

Jerry Whittle

Check out the Val() function. It will extract the numbers prior to any ABCs
and some other characters. Then you can sort on it as Val returns a number.

In the field of a query something like:

TheNumbers: Val([YourFieldName])
 
F

fredg

I have a field that has numbers and occasionally a letter amended:
1
2
3
3a
30
300
4
5a
5b
6
I need to parse the field ,extracting the numbers. In the end, I would like
to sort the field numerically.

How can I parse based on the difference between numbers and text?

You just want the leading number values?
=Val([FieldName])
will return the leading number value, i.e. Val(3a) and Val(300)
returns 3 and 300 respectively.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top