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

Need to check for substring within string?

Status
Not open for further replies.

kre1973

IS-IT--Management
May 5, 2006
47
US
I have the following string data in Excel:

{"NSD, Q-3557, WAN SUPPORT", "FIELD NETWORK"}
{"ACTUARIAL VALUATION SYSTEMS", "COMPUTER OPERATIONS"}
{"MQ", "COMPUTER OPERATIONS", "MQ", "HO CASE MGMT SUPPORT"}
{"Q-6996 ESA, PASSWORD SUPPORT", "EIMT-EBSS/WINSIGN/SITEMNDR/LDAP", "Q-5576, THE SERVICE CENTER"}
{"Q-6996 ESA, PASSWORD SUPPORT"}
{"COMPUTER OPERATIONS"}
{"WINDOWS SRVR TEAM INTERNAL SUP", "COMPUTER OPERATIONS", "EMAT"}
{"ACTUARIAL EXPERIENCE STUDIES", "COMPUTER OPERATIONS"}
{"NSD, Q-4354, FIELD PC SUPPORT", "AGENCY BUSINESS SYSTEMS"}
{"ACTUARIAL EXPERIENCE STUDIES", "COMPUTER OPERATIONS"}
{"COMPUTER OPERATIONS"}

I'm using a formula to look for the substring "COMPUTER OPERATIONS" within the strings above. The formula works great, except I need to check to see if "COMPUTER OPERATIONS" is the last occurance of the substring within the string.

I hope I explained it correctly.

thanks

{table.col} like "*COMPUTER OPERATIONS*"

 
Instrrev({YourField},"COMPUTER OPERATIONS")> will return the starting position of the last occurrence of the substring, or zero if it is not found.

Does this help?

Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports

"What version of URGENT!!! are you using?
 
Try something like this:

stringvar array x := "";
if instr({table.string},",") > 0 then
x := split({table.string},",") else
x := {table.string};
x[ubound(x)] = "COMPUTER OPERATIONS";

This will return true if "COMPUTER OPERATIONS" is the last element in the array.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top