Thread: display error
View Single Post
 
Old 08-04-2013, 08:40 PM
BobBridges's Avatar
BobBridges BobBridges is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

Jolinchew, are you saying you want—well, let me rephrase it and you tell me whether it's right:

Quote:
I have a string that is at least four characters long. Somewhere in that string is the substring "2013". Wherever that exists, I want the string to be truncated just before that. For instance:

"1234567892103": Display "123456789"
"abc7892013zyx321": Display "abc789" (dropping "2013" and everything that comes after it)
"Happy New Year!": Display "Happy New Year!" (no change)
"20136458cabd": Display "" (no string)
"4.52013672013892013": Display "4.5" (it's the first "2013" that matters)
"(212) 456-2013": Display "(212) 456-"
"2014 - 2013 = 1": Display "2014 - " (with trailing space)
If all that's right, it seems to me you need to use the FIND function to find "2013". Once you know what position it's in, you can use the LEFT function to keep just the parts of the character string that come before that position. Does that tell you what you need to know, or do you need a little coaching to use those two functions?

Last edited by BobBridges; 08-04-2013 at 08:41 PM. Reason: Fix a typo
Reply With Quote