Text Functions to Retrieve Strings

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to retrieve the string between the 1st and 2nd occurance of the
underscore _ character. Sample string is
ALL-REGIONS_65959_2007_07_Detail.csv.
Here's what I've got so far.

Mid$([FileName],InStr([FileName],"_")+1,5)

How do I get it to retrieve all characters between the 1st and 2nd underscore?
 
What you have should do it unless all records do not have exactly 5 character
between the two underscores.

Try this ---
Left(Right([FileName],Len([FileName])-InStr([FileName],"_")+1),InStr([FileName],"_")-1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top