A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

If then Else mail merge field



 
 
Thread Tools Display Modes
  #1  
Old June 5th, 2009, 12:29 AM posted to microsoft.public.word.mailmerge.fields
Ram
external usenet poster
 
Posts: 190
Default If then Else mail merge field

HI

Is there a way to evaluate 3 condition with the if then else field option.

I would like Field 4 to look at fields 1-3 and give me the value of the
field the has a Yes. In the example below the vlaue of Field3 would be
populated in Field 4

Field1 No
Field2 No
Field3 Yes

Thanks for any help

  #2  
Old June 5th, 2009, 12:57 AM posted to microsoft.public.word.mailmerge.fields
Peter Jamieson
external usenet poster
 
Posts: 4,550
Default If then Else mail merge field

Your requirement is a bit ambiguous because if you want the value of the
field that has value "Yes", the value is always going to be "yes".

If ou actually want to put the /name/ of the field whose value is "Yes"
into a variable you can work with, then you could use something like

{ IF "{ MERGEFIELD Field1 }" = "Yes" "{ SET myField4 "Field1" }" ""
}{ IF "{ MERGEFIELD Field2 }" = "Yes" "{ SET myField4 "Field2" }" ""
}{ IF "{ MERGEFIELD Field3 }" = "Yes" "{ SET myField4 "Field3" }" ""
}

If more than one of Field1, Field2, Field3 has the value "Yes" then the
above code would set myField4 to the field with the highest number (e.g.
if all are "Yes", myField4 would be set to "Field3"

You could reference myField4 using

{ REF myField4 }

This assumes that
a. your Field1,Field2, Field3 are merge fields
b. the "Yes" value is always precisely "Yes" - if it could be "YES"
etc. then you would be better off with

{ IF "{ MERGEFIELD Field1 \*Upper }" = "YES" "{ SET myField4 "Field1" }"
"" }

or some such

But that result does not look particularly useful to me either - maybe
you want to set myfield4 to some other value depending on which of
Field1, Field2, Field3 is "yes" ? If so, perhaps you can spell it out.


Peter Jamieson

http://tips.pjmsn.me.uk

ram wrote:
HI

Is there a way to evaluate 3 condition with the if then else field option.

I would like Field 4 to look at fields 1-3 and give me the value of the
field the has a Yes. In the example below the vlaue of Field3 would be
populated in Field 4

Field1 No
Field2 No
Field3 Yes

Thanks for any help

  #3  
Old June 5th, 2009, 01:43 PM posted to microsoft.public.word.mailmerge.fields
Ram
external usenet poster
 
Posts: 190
Default If then Else mail merge field

Thank You this was very helpful

"Peter Jamieson" wrote:

Your requirement is a bit ambiguous because if you want the value of the
field that has value "Yes", the value is always going to be "yes".

If ou actually want to put the /name/ of the field whose value is "Yes"
into a variable you can work with, then you could use something like

{ IF "{ MERGEFIELD Field1 }" = "Yes" "{ SET myField4 "Field1" }" ""
}{ IF "{ MERGEFIELD Field2 }" = "Yes" "{ SET myField4 "Field2" }" ""
}{ IF "{ MERGEFIELD Field3 }" = "Yes" "{ SET myField4 "Field3" }" ""
}

If more than one of Field1, Field2, Field3 has the value "Yes" then the
above code would set myField4 to the field with the highest number (e.g.
if all are "Yes", myField4 would be set to "Field3"

You could reference myField4 using

{ REF myField4 }

This assumes that
a. your Field1,Field2, Field3 are merge fields
b. the "Yes" value is always precisely "Yes" - if it could be "YES"
etc. then you would be better off with

{ IF "{ MERGEFIELD Field1 \*Upper }" = "YES" "{ SET myField4 "Field1" }"
"" }

or some such

But that result does not look particularly useful to me either - maybe
you want to set myfield4 to some other value depending on which of
Field1, Field2, Field3 is "yes" ? If so, perhaps you can spell it out.


Peter Jamieson

http://tips.pjmsn.me.uk

ram wrote:
HI

Is there a way to evaluate 3 condition with the if then else field option.

I would like Field 4 to look at fields 1-3 and give me the value of the
field the has a Yes. In the example below the vlaue of Field3 would be
populated in Field 4

Field1 No
Field2 No
Field3 Yes

Thanks for any help


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.