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

Split Formula Problem

Status
Not open for further replies.

suechamps

Technical User
May 26, 2005
15
0
0
US
I'm using Crystal 8.5 and I'm having difficulty using the split formula. I have a string that I need to split "-" character in the string. The "-" does not fall in the same place in each string:
12-ABCDE
123-FGH
and one instance of
123-ABC-DEF GHI

I am using the following formula which I adapted for my needs from another post that I found here:
split({USERINFO.DIVISION},"-")[2]
I get the following message when I check for errors:
A subscript must be between 1 and the size of the array

If I remove the [2] from the formula I get the message:
The result of a formula cannot be an array

I was under the impression that the result of this formula is to return an array??

Any suggestions?

Thanks in advance!

Sue
 
Hi Sue, and I gather that the requirement is to extract the second value from this dash delimited string.

Try the following formula:

if ubound(split({USERINFO.DIVISION},"-")) > 1 then
split({USERINFO.DIVISION},"-")[2]
else
{USERINFO.DIVISION}

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top