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

Nested IF formula including IS LIKE...... 1

Status
Not open for further replies.
Apr 11, 2008
68
GB
I am trying to write a formula that will take a different number of characters from a field value dependent on the fields actual value, but am struggling.

I want to evaluate the field value (which I thought would need an IS LIKE command) and then based on that result use LEFT to take a set number of characters from the field value.

The field is {ordhd.oh_cust_post}, so can take either the form

AA11 1AA or AA1 1AA

I need the formula to evaluate {ordhd.oh_cust_post} to establish which of the two forms above it takes, then based on which one it is, take either the left 6 or 5 characters respectively.

Anyone got any good ideas on how to structure this, as though I use Crystal alot, my formula writing is pretty simplistic!

Thanks in advance
 
Hi,
You want to leave the last 2 AA s correct?

Try:
Code:
NumberVar Spc := InStr({ordhd.oh_cust_post},' ');
Left({ordhd.oh_cust_post},Spc + 1)



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks Turkbear

That works a treat!

I'll now work through the formula and hopefully learn how to use it in similar scenarios in the future.

Awesome!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top