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

Left function

Status
Not open for further replies.

mmwdmr

Technical User
Jan 10, 2002
119
US
I am using version 9 and I am trying to base a formula on the first two digits in a 12 digit string. I know I would use the LEFT function but I am unsure of the syntax. It would be something like,

if the first two digits are 03 or if the first two digits are 77 then "myfieldname" else {databasefield}.

If the above criteria is not met, I need the formula to return the 8th and 9th digits (MID function?) of the 12 digit string.

Any assistance would be appreciated.
 
Try:

if left({table.string},2) in ["03","77"] then "myfieldname" else
mid({table.string}, 8,2)

Note that you said you wanted the default to be databasefield and then you said you wanted the default to be the 8th or 9th digit, so I chose to show the 8th and 9th digit.

-LB
 
You put it together the way I intended. Sorry for the confusion and thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top