Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncating Text and then sorting 1

Status
Not open for further replies.

GMAN33

IS-IT--Management
Dec 4, 2002
115
US
Hi Gang,

CR9 Pro. I have several hundred detail texts in a table that are like "0302-Patient name is missing". All have a 4 digit number at the beginning. I would like to create a formula that will truncate the first 4 chars and than sort by this number. Any help on this would be appreciated.

Take care
GMAN
 
Hey GMan,

If you want to extract the numerical part for sorting, you can use the Val function:

Val(Replace("0302-Patient name is missing",'-',''))

To simply display the text without the numerical code, you can use this:

Mid("0302-Patient name is missing",InStr("0302-Patient name is missing",'-')+1)

This allows for the code to be any length.

All the best,

Naith
 
Naith

FANTASTIC....worked like a charm. I used the
Val(Replace("0302-Patient name is missing",'-','')) but replaced the text with the variable without quotes and worked great.

Thanks alot for the help

GMAN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top