Separate text from numbers

ecohen

New Member
Joined
Feb 21, 2005
Messages
5
Hi,
It wil be easier if I showing you an example:
I have 1 text field with those values:
@HEMZ00
@TOXP00
@TOXP01
@TOXP02
the other column, I would like to create an expresssion who's giving methis kind OF RESULTS:

@HEMZ
@TOXP
@TOXP
@TOXP

THANKS
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
If the data is as you have posted try the Left function.

NewField:Left([YourField], 5)
 
Upvote 0
Sorry,
I ddin''t mentioned that we could have :
@HEZ00
@TOXYTP0580
@TOWERWXP701
@TEROXP02
 
Upvote 0
Is it Access or Excel you require this for?

If it's Excel then take a look at the answers to your post in the Excel forum.

If it's Access another method will need to be found.
 
Upvote 0
One way could be to write a UDF that finds the first number and returns everything before it.

Perhaps something like this:
Code:
Function GetText(strField As String) As String
Dim I As Integer
Dim L As Integer
Dim boolFound As Boolean
Dim strTest As String

    L = Len(strField)
    
    While I <= L And Not boolFound
        I = I + 1
        strTest = Mid(strField, I, 1)
        boolFound = IsNumeric(strTest)
        
    Wend
    
    GetText = Left(strField, I - 1)
    
End Function
 
Upvote 0

Forum statistics

Threads
1,221,851
Messages
6,162,429
Members
451,765
Latest member
craigvan888

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top