Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 04-05-2017, 12:02 PM
robert3 robert3 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Apr 2017
Posts: 3
robert3 is on a distinguished road
Default Multiple Mail Merge Switches


Below is a example of a Microsoft Word 2010 Mail Merge that has me stumped. I need to format the Cash_Credit field as two decimal field, however since there are already Before and After switches, it gets confusing. I have searched and cannot find any discussions or examples of this particular scenario. I would like to include/combine another switch, such as \# $ ##.00

Alt + F9 View
{MERGEFIELD Cash_Credit \b “You were selected to receive a cash credit of”\f which will be mailed to the address we have on file.” \* MERGEFORMAT}

Normal View
You were selected to receive a cash credit of «Cash_Credit» which will be mailed to the address we have on file.
Reply With Quote
  #2  
Old 04-05-2017, 02:37 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,199
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Other switches don't work with the \b and \f switches (even the \* MERGEFORMAT switch won't work). For what you want, you need an IF test coded along the lines of:
{IF«Cash_Credit»<> 0 "You were selected to receive a cash credit of {MERGEFIELD Cash_Credit \# $,0.00} which will be mailed to the address we have on file."}

Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the 'Insert Merge Field' dropdown.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 04-06-2017, 02:57 PM
robert3 robert3 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Apr 2017
Posts: 3
robert3 is on a distinguished road
Default

Great recommendation, Paul! Thanks for the fast reply.

The IF works! it populates the before and after text, including the Cash_Credit value. However, having one small issue now. When the source value contains no data (null; empty cells in Excel) the Comparison Operator <> doesn't identify this, but still populates the before and after text.

i.e. You were selected to receive a cash credit of which will be mailed to the address we have on file.

Also, here are a few things that I've tried, but didnt work:
>= 1
!= 0



Any additional help will be greatly appreciated.
Reply With Quote
  #4  
Old 04-06-2017, 03:03 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,199
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Try replacing the 0 with "".
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 04-07-2017, 10:22 AM
robert3 robert3 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Apr 2017
Posts: 3
robert3 is on a distinguished road
Default

Paul, your suggestion worked! but, I had to change the logic slightly so that the before and after text did not populate when there was a null value in the cell.

here's what I ended up using.

{IF { MERGEFIELD Cash_Credit \*MERGEFORMAT} = "" "" "Before test {MERGEFIELD Cash_Credit\# $,0.00;;} after text."}

Much appreciation to you and this great forum!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using multiple IF statements on a mail merge ajh19742000 Mail Merge 1 11-01-2016 06:11 PM
Multiple mail merge PKAYHORM Mail Merge 1 09-29-2013 07:45 PM
Multiple Mail Merge? imogul Mail Merge 1 06-24-2011 07:20 PM
Mail merge switches Jan Collier Mail Merge 0 08-29-2010 06:06 AM
Help with switches: Word mail merge with Excel ks_ Mail Merge 0 12-09-2009 05:09 PM


All times are GMT -7. The time now is 07:12 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft