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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I shorten a string 2

Status
Not open for further replies.

scottpdann

Technical User
May 14, 2003
44
US
I have a field with values like

B7527*2*2004
B7527A*2*2004

Is there a formula to convert it so that every character from the first * and right disappear. Looking like this

B7527
B7527A

Thank you.


 
If you know the exact length you can use a formula like this

{Table.field} [1 to 3]

This will only return the first three characters from the field.


Kchaudhry
 
That will solve part of the problem.

I will still get records like

B7527A Which is fine

and

B7527* Which is not.

If I take those results and, can i then write a formula dropping the asterik from the ones that are left?

 
Try this:

left({table.field}, instr({table.field}, "*") - 1);

-dave
 
Try this:
Code:
Left({table.field},Instr({table.field},"*")-1)

~Brian
 
I guess I was a couple of minutes late to post my suggestion :)

Kchaudhry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top