#1
|
|||
|
|||
Substituting a value using MERGEFIELD
My Excel 2010 spread sheet's source data field contains a value of "YES" or "NO". My Word 2010 template's merge field causes either "YES" or "NO" to appear in its place in the merged document. Is there a way to define the merge field to cause the word "email" to be inserted instead of "YES" and for "hardcopy" to be inserted instead of "NO"?
|
#2
|
||||
|
||||
Hi Charlie,
You can use an IF field, coded along the lines of: {IF«MyField»= "YES" "email" "hardcopy"} where 'MyField' is the field name in your data. Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - you can't simply type them or copy & paste them from this message. Likewise, you can't type or copy & paste the chevrons (ie '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Paul - Thanks so much! I'm taking your "IF..." statement to mean, "If the field contains "Yes," substitute "electronic" and otherwise substitute "hardcopy". I'll try to acquire a better understanding of how "IF..." works. Thanks again for putting me on the right track.
|
#4
|
|||
|
|||
See the Field Codes Reference for IF Field
{ IF Expression1 Operator Expression2 TrueText FalseText } Sometimes quotation marks around things are needed since the field uses spaces as delimiters. |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word vs Excel (NEXTIF, SKIPIF mergefield) | jerry00769 | Mail Merge | 3 | 04-30-2012 03:43 PM |
Mergefield IF/ELSE determin source type | legg1 | Mail Merge | 6 | 03-26-2012 09:18 PM |
Mail Merge to multiple .doc files named after a mergefield | nicnad | Mail Merge | 1 | 02-22-2012 01:59 AM |
Mail Merge to print specific record based on mergefield criterias | nicnad | Mail Merge | 1 | 02-22-2012 01:53 AM |
Mergefield date error | michielvanderbiest | Mail Merge | 1 | 04-12-2010 11:22 PM |