Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
ram ram is offline
external usenet poster
 
Posts: 18
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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
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   Report Post  
Posted to microsoft.public.word.mailmerge.fields
ram ram is offline
external usenet poster
 
Posts: 18
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


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you limit the text in a merge field for mail merge documents? jennifer Mailmerge 1 October 23rd 08 06:22 AM
Mail merge using calculation field in an IF field Ed Mailmerge 8 June 11th 07 01:24 PM
Insert Merge Field problem with Word-Mail Merge from Excel documen Augusta E. Microsoft Word Help 2 June 20th 05 10:59 AM
Mail merge field different in datasource & insert a field menu Silvs Mailmerge 1 April 22nd 05 06:18 AM
Mail merge field isn't displaying all the text in a field. Can I . mojohubbard Mailmerge 3 March 28th 05 04:45 PM


All times are GMT +1. The time now is 09:39 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"