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

Everything before last "-" in a string 1

Status
Not open for further replies.

mbDutch

MIS
Nov 13, 2007
39
US
Hello (again) -

I am in need of a formula that returns everything in a string that comes before
the last - (dash). For instance, if a part number is EX-P002-AB I want it to return
EX-P002. If a part number is EC-V003 I just want it to return EC.

Many thanks in advance,

Marco
 
stringvar x := {table.string};
if instr(x,"-") <> 0 then
left(x,instrrev(x,"-")-1) else
x;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top