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

Word Merge field Formula - use of Right

Status
Not open for further replies.

catbert

Technical User
May 1, 2003
56
0
0
GB
Hi, I have ad a good look around and as I can't find anything about this I assume it can't be done - but I live in hope. I currently have the following statment:

{If{Mergefield "PE"}="M11" "monday" {If Mergefield "PE"}="M12" "tuesday" If{Mergefield "PE"}="M13 "wednesday" {If{Mergefield "PE"}="M14 "thursday "friday"}}}}

This works perfectly, but - the idea is to calculate the day from the last number in this code and these codes run in four week cycles - and may start with four other letter codes. So to cover every option the forumla will have to be much longer. To be tidy I want to say look at the right hand digit - then I can just nest my IF statement for 1-5.

but whatever syntax I use gets an error - can anyone help me write this right:

{If RIGHT({Mergefield "PE"},1)="5" "friday" {if RIGHT ({Mergefield "PE"},1)="4" "thursday" }} etc etc

Please note I do know how to do this in excel and access - but this data is coming from a system written in sculptor which I cannot touch so my only option is to deal with it once it is merged with word.

Many thanks
CB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top