Take the 2-minute tour ×

Is it possible to use the Left function, or another function if better suited, to left trim the values in a field up to a static character, in this case a dash? There is no set amount of characters leading up to the dash, so the length will be greater or smaller but will always have a dash in the field.

Here's an example of some values that could be in the field:

Test1 - Test1 description

Test1 Test2 - Test1 Test2 description

Test1 Test2 Test3 - Test1 Test2 Test3 description

Test4 - Test4 description

After the trim, the end result of record one would be Test1.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You can use a mixture of Left or Mid and Instr.


Where Description is the name of your field.

share|improve this answer
This trims everything from Left up to but not including the "-"? I could in theory use the Right function as well to trim up to the "-". –  Muhnamana Feb 21 '13 at 16:49
You must have tested before I added the -1, it trims the "-" as well. –  Fionnuala Feb 21 '13 at 16:50
I did...hahaha...so the -1 excludes the character you are searching for? –  Muhnamana Feb 21 '13 at 16:51
Instr(..,"-") is the position of "-", say 10, so Instr(..,"-")-1 is just before "-", say 9, so you have left(string,9) –  Fionnuala Feb 21 '13 at 16:52
Got it...so I could use -2, which will take off the "-" and the space before the dash. Thanks! –  Muhnamana Feb 21 '13 at 16:54

Your Answer


