Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
I can't for the life of me figure out how to insert a field base on multiple
conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
{ IF { MERGEFIELD Amount } = 50 { IF { MERGEFIELD Amount } = 100 "The
amount is between 50 and 100." "" } "" } You must use Ctrl+F9 to insert each pair of field delimiters and make sure that you have a space either side of the operator =. You use Alt+F9 to toggle off the display of the field codes. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Stephen Green" wrote in message ... I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
{ IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } =100 "The
amount is between 50 and 100" "" }" "" } -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Stephen Green wrote: I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
Oops - a typo - that should read
{ IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } = 100 "The amount is between 50 and 100" "" }" "" } Spaces are important! -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } =100 "The amount is between 50 and 100" "" }" "" } Stephen Green wrote: I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
Thanks, Guys!
I see one difference between your suggestions. There is a double quote before the second { IF in Graham's suggestion (below) which is missing in Doug's. Is this important? Stephen "Graham Mayor" wrote in message ... Oops - a typo - that should read { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } = 100 "The amount is between 50 and 100" "" }" "" } Spaces are important! -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } =100 "The amount is between 50 and 100" "" }" "" } Stephen Green wrote: I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
I"ve tried Doug's code and it works. I don't know if the extra quote would
enhance or detract form the efficacy (I haven't tried). While we're on the subject, does each Merge Condition have to be typed or can I cut and paste, the edit them. So far I have had trouble ceeping track of the Conditions as they have a tendency to disappear from view... Stephen "Stephen Green" wrote in message ... Thanks, Guys! I see one difference between your suggestions. There is a double quote before the second { IF in Graham's suggestion (below) which is missing in Doug's. Is this important? Stephen "Graham Mayor" wrote in message ... Oops - a typo - that should read { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } = 100 "The amount is between 50 and 100" "" }" "" } Spaces are important! -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } =100 "The amount is between 50 and 100" "" }" "" } Stephen Green wrote: I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
As far as I know, the double quotes are only required around a string that
includes spaces, such as "The amount is between 50 and 100." but their use around the individual parts (true part, false part) of the result will not cause a problem. Such field constructions can be copied and pasted. The important thing is that the field delimiters {} must be inserted by the use of Ctrl+F9. The similar looking characters inserted by the use of the keys on the keyboard will not work. If the field codes disappear, use Alt+F9 to toggle on their display. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Stephen Green" wrote in message ... I"ve tried Doug's code and it works. I don't know if the extra quote would enhance or detract form the efficacy (I haven't tried). While we're on the subject, does each Merge Condition have to be typed or can I cut and paste, the edit them. So far I have had trouble ceeping track of the Conditions as they have a tendency to disappear from view... Stephen "Stephen Green" wrote in message ... Thanks, Guys! I see one difference between your suggestions. There is a double quote before the second { IF in Graham's suggestion (below) which is missing in Doug's. Is this important? Stephen "Graham Mayor" wrote in message ... Oops - a typo - that should read { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } = 100 "The amount is between 50 and 100" "" }" "" } Spaces are important! -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } =100 "The amount is between 50 and 100" "" }" "" } Stephen Green wrote: I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#8
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
As Doug says, quotes are not *required* around fields, but they are good
practice as they make the construction easier to understand. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Doug Robbins - Word MVP wrote: As far as I know, the double quotes are only required around a string that includes spaces, such as "The amount is between 50 and 100." but their use around the individual parts (true part, false part) of the result will not cause a problem. Such field constructions can be copied and pasted. The important thing is that the field delimiters {} must be inserted by the use of Ctrl+F9. The similar looking characters inserted by the use of the keys on the keyboard will not work. If the field codes disappear, use Alt+F9 to toggle on their display. "Stephen Green" wrote in message ... I"ve tried Doug's code and it works. I don't know if the extra quote would enhance or detract form the efficacy (I haven't tried). While we're on the subject, does each Merge Condition have to be typed or can I cut and paste, the edit them. So far I have had trouble ceeping track of the Conditions as they have a tendency to disappear from view... Stephen "Stephen Green" wrote in message ... Thanks, Guys! I see one difference between your suggestions. There is a double quote before the second { IF in Graham's suggestion (below) which is missing in Doug's. Is this important? Stephen "Graham Mayor" wrote in message ... Oops - a typo - that should read { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } = 100 "The amount is between 50 and 100" "" }" "" } Spaces are important! -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } =100 "The amount is between 50 and 100" "" }" "" } Stephen Green wrote: I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#9
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
Thanks Doug!
The Alt-F9 key did the trick. Now if I only understood the code you gave me!!! Thanks again to you and Graham! Stephen "Doug Robbins - Word MVP" wrote in message ... As far as I know, the double quotes are only required around a string that includes spaces, such as "The amount is between 50 and 100." but their use around the individual parts (true part, false part) of the result will not cause a problem. Such field constructions can be copied and pasted. The important thing is that the field delimiters {} must be inserted by the use of Ctrl+F9. The similar looking characters inserted by the use of the keys on the keyboard will not work. If the field codes disappear, use Alt+F9 to toggle on their display. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Stephen Green" wrote in message ... I"ve tried Doug's code and it works. I don't know if the extra quote would enhance or detract form the efficacy (I haven't tried). While we're on the subject, does each Merge Condition have to be typed or can I cut and paste, the edit them. So far I have had trouble ceeping track of the Conditions as they have a tendency to disappear from view... Stephen "Stephen Green" wrote in message ... Thanks, Guys! I see one difference between your suggestions. There is a double quote before the second { IF in Graham's suggestion (below) which is missing in Doug's. Is this important? Stephen "Graham Mayor" wrote in message ... Oops - a typo - that should read { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } = 100 "The amount is between 50 and 100" "" }" "" } Spaces are important! -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Graham Mayor wrote: { IF { Mergefield Amount } = 50 "{ IF { Mergefield Amount } =100 "The amount is between 50 and 100" "" }" "" } Stephen Green wrote: I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#10
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
An alternative field construction is:
{IF{=({MERGEFIELD Amount}50)+({MERGEFIELD Amount}100)}= 0 "The amount is between 50 and 100"} Cheers PS: The output text really should have ", inclusive" at the end. "Stephen Green" wrote in message ... I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#11
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
macropod!
Exactly what does this code mean? It the field is less than 50 and the field is greater that 100 = 0??? Also, what does your PS mean? (The output text really should have ", inclusive" at the end.) Thanks Stephen "macropod" wrote in message ... An alternative field construction is: {IF{=({MERGEFIELD Amount}50)+({MERGEFIELD Amount}100)}= 0 "The amount is between 50 and 100"} Cheers PS: The output text really should have ", inclusive" at the end. "Stephen Green" wrote in message ... I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#12
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
Both ({ MERGEFIELD Amount } 50) and ({ MERGEFIELD Amount } 100)
evaluate to 0 if the number = 50 on = 100 If the number is outside of that range, one of them will equate to 1 and thus the sum of the two will not be 0. Macropod has made it a little harder for you to understand by only including the true result. There could have been a space and a pair of double quotes after "The number is between 50 and 100" but as there was nothing to be displayed, it can be omitted. If you had wanted the construction to return "The number is not between 50 and 100" if it wasn't in that range, then you would have { IF { = ({ MERGEFIELD Amount } 50) + ({ MERGEFIELD Amount } 100) } = 0 "The Number is between 50 and 100" "The number is not between 50 and 100" } Re the PS, your condition would be true for values of 50 and 100. In mathematical terms, the only numbers (whole numbers that is) that are BETWEEN 50 and 100 are the numbers 51 to 99. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Stephen Green" wrote in message ... macropod! Exactly what does this code mean? It the field is less than 50 and the field is greater that 100 = 0??? Also, what does your PS mean? (The output text really should have ", inclusive" at the end.) Thanks Stephen "macropod" wrote in message ... An alternative field construction is: {IF{=({MERGEFIELD Amount}50)+({MERGEFIELD Amount}100)}= 0 "The amount is between 50 and 100"} Cheers PS: The output text really should have ", inclusive" at the end. "Stephen Green" wrote in message ... I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
#13
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Multiple conditions in merge
Thanks for the explanation. I'm beginning to understand.
It would be easier, of course, if the merge code were the same as SQL... Stephen "Doug Robbins - Word MVP" wrote in message ... Both ({ MERGEFIELD Amount } 50) and ({ MERGEFIELD Amount } 100) evaluate to 0 if the number = 50 on = 100 If the number is outside of that range, one of them will equate to 1 and thus the sum of the two will not be 0. Macropod has made it a little harder for you to understand by only including the true result. There could have been a space and a pair of double quotes after "The number is between 50 and 100" but as there was nothing to be displayed, it can be omitted. If you had wanted the construction to return "The number is not between 50 and 100" if it wasn't in that range, then you would have { IF { = ({ MERGEFIELD Amount } 50) + ({ MERGEFIELD Amount } 100) } = 0 "The Number is between 50 and 100" "The number is not between 50 and 100" } Re the PS, your condition would be true for values of 50 and 100. In mathematical terms, the only numbers (whole numbers that is) that are BETWEEN 50 and 100 are the numbers 51 to 99. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Stephen Green" wrote in message ... macropod! Exactly what does this code mean? It the field is less than 50 and the field is greater that 100 = 0??? Also, what does your PS mean? (The output text really should have ", inclusive" at the end.) Thanks Stephen "macropod" wrote in message ... An alternative field construction is: {IF{=({MERGEFIELD Amount}50)+({MERGEFIELD Amount}100)}= 0 "The amount is between 50 and 100"} Cheers PS: The output text really should have ", inclusive" at the end. "Stephen Green" wrote in message ... I can't for the life of me figure out how to insert a field base on multiple conditions. What I'd like to do, for instance, is something like this: If Amount = 50 And Amount =100 Then "The amount is between 50 and 100" Can anyone help? Stephen |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I create a merge document from multiple sources? | Mailmerge | |||
Saving final document to multiple files when merge document has multiple section | Mailmerge | |||
Combining multiple merge documents | Mailmerge | |||
Multiple merge with IncludeText generating extraneous hidden chara | Mailmerge | |||
Merge multiple documents? | New Users |