Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2013, 06:46 AM
kingswood kingswood is offline How to Suppress non-monetary 0 Windows 7 64bit How to Suppress non-monetary 0 Office 2010 64bit
Novice
How to Suppress non-monetary 0
 
Join Date: Dec 2013
Posts: 5
kingswood is on a distinguished road
Default How to Suppress non-monetary 0

Hello folks,

Mailmerge is new for me so I apologize for the elementary question. I have several fields in Excel that are blank. When these fields get mapped into the Word document, they are appearing as zero (0). If the value coming from Excel is blank, I want the field to display as blank on the Word document. Below is the latest example I have tried, but it does not work. Can someone help me with this? Thanks in advance.




{MERGEFIELD Petitioner_Att_Bar {IF {Mergefield Petitioner_Att_Bar} <> "" "{IF {Mergefield Petitioner_Att_Bar <> "0" "{Mergefield Petitioner_Att_Bar}" ""}" ""} \* MERGEFORMAT}
Reply With Quote
  #2  
Old 12-02-2013, 02:54 PM
macropod's Avatar
macropod macropod is offline How to Suppress non-monetary 0 Windows 7 32bit How to Suppress non-monetary 0 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Kingswood,

In addition to the blanks, do you also have true 0 values?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-03-2013, 06:55 PM
kingswood kingswood is offline How to Suppress non-monetary 0 Windows 7 64bit How to Suppress non-monetary 0 Office 2010 64bit
Novice
How to Suppress non-monetary 0
 
Join Date: Dec 2013
Posts: 5
kingswood is on a distinguished road
Default

Hello Macropod, thank you very much for asking. There are no true 0 values. Each of the four fields either have values coming from Excel or they don't, and none of the four fields will have a 0 value. I would really appreciate if you know how to do this.

If you have the solution and if it's not too much trouble, I would really appreciate both solutions. At some point in the future, I may need to allow the 0. Thank you.
Reply With Quote
  #4  
Old 12-03-2013, 07:56 PM
macropod's Avatar
macropod macropod is offline How to Suppress non-monetary 0 Windows 7 32bit How to Suppress non-monetary 0 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

To control number & currency formatting in Word, add a numeric picture switch to the mergefield. To do this:
• select the field;
• press Shift-F9 to reveal the field coding. It should look something like {MERGEFIELD MyData};
• edit the field so that you get {MERGEFIELD MyData \# $,0.00} (or whatever other numeric format you prefer - see below);
• position the cursor anywhere in this field and press F9 to update it.
Note: The '\# $,0.00' in the field is referred to as a numeric picture switch. Other possibilities include:
• \# 0 for rounded whole numbers
• \# ,0 for rounded whole numbers with a thousands separator
• \# ,0.00 for numbers accurate to two decimal places, with a thousands separator
• \# $,0 for rounded whole dollars with a thousands separator
• \# "$,0.00;($,0.00);'-'" for currency, with brackets around negative numbers and a hyphen for 0 values
The precision of the displayed value is controlled by the '0.00'. You can use anything from '0' to '0.000000000000000'.
If you use a final ';' in the formatting switch with nothing following, (eg \# "$,0.00;($,0.00);") zero values will be suppressed. Note that this suppresses 0s resulting from empty fields and from fields containing 0s.

Handling cells that may be empty, as distinct from holding 0 values that you want to display requires a different approach. You can test the contents of a mergefield for text/nulls vs numbers by doing the following:
• select the field and Press Ctrl-F9 twice to enclose it in a pair of fields, thus { { «MyData» } };
• between the last pair of field braces press Ctrl-F9 twice to generate another pair of fields so that you end up with: { {SET Val «MyData» }{ { } } };
• before the new last pair of field braces press Ctrl-F9 to generate another field so that you end up with: { {SET Val «MyData» }{ { }{ } } };
• fill in around the new field braces so that you end up with: {QUOTE{SET Val «MyData»}{IF{REF Val}={=Val} {=Val \# $,0.00}}} (you can use any numeric format - see above);
• position the cursor anywhere in this field and press F9 to update it.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 12-06-2013, 07:12 PM
kingswood kingswood is offline How to Suppress non-monetary 0 Windows 7 64bit How to Suppress non-monetary 0 Office 2010 64bit
Novice
How to Suppress non-monetary 0
 
Join Date: Dec 2013
Posts: 5
kingswood is on a distinguished road
Default

Hello Macropod, thank you very much! This worked for me. Being new to mail merge, I really appreciate your detail and step by step approach to this solution. Thank you again!
Reply With Quote
  #6  
Old 12-07-2013, 07:26 AM
KevCarter KevCarter is offline How to Suppress non-monetary 0 Mac OS X How to Suppress non-monetary 0 Office for Mac 2011
Novice
 
Join Date: Dec 2013
Location: Wisconsin
Posts: 2
KevCarter is on a distinguished road
Default

kingswood,

I hope you don't mind me jumping in with an alternative, and a question?

Mr. Edstein's response is very cool, he clearly is a very experienced OFFICE user, which I am not. I'm not very comfortable writing this type of procedure in WORD, I can't seem to remember the proper syntax and / or function keys to get there, however I'm a little more comfortable working in EXCEL. I do a lot of mail merges for creating golf scorecards and scoresheets where the handicaps sometimes need special formatting. I have taken to creating a new column in EXCEL using the text function to get what I want, and using it as the merge field.

The solution I use is to create the additional field "Petitioner_Att_Bar_Text" in my EXCEL table using the formula

= TEXT(Petitioner_Att_Bar,"$###,##0.00;-$###,##0.00;")

and using that field in the mail merge.

Mr. Edstein, is there a downside to attacking the problem in this manner?

Thanks for allowing me to participate!

Kevin
Reply With Quote
  #7  
Old 12-07-2013, 09:10 AM
macropod's Avatar
macropod macropod is offline How to Suppress non-monetary 0 Windows 7 32bit How to Suppress non-monetary 0 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by KevCarter View Post
The solution I use is to create the additional field "Petitioner_Att_Bar_Text" in my EXCEL table using the formula

= TEXT(Petitioner_Att_Bar,"$###,##0.00;-$###,##0.00;")

and using that field in the mail merge.

Mr. Edstein, is there a downside to attacking the problem in this manner?
Hi Kevin,

The disadvantage that immediately springs to mind is the fact you need to modify the datasource - adding an extra column for every existing column that has the problem 0s in it. In some organisations, that would be frowned upon - or simply not possible (e.g. one generally can't go around modifying corporate databases).
Quote:
I'm not very comfortable writing this type of procedure in WORD, I can't seem to remember the proper syntax and / or function keys to get there
Fair enough, but that's why we have word-processors, etc., where one can store notes (which in this case require little more than a quick copy/paste) for things we don't use very often. Doubtless you have something such already for Excel...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 12-07-2013, 09:16 AM
KevCarter KevCarter is offline How to Suppress non-monetary 0 Mac OS X How to Suppress non-monetary 0 Office for Mac 2011
Novice
 
Join Date: Dec 2013
Location: Wisconsin
Posts: 2
KevCarter is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi Kevin,

The disadvantage that immediately springs to mind is the fact you need to modify the datasource - adding an extra column for every existing column that has the problem 0s in it. In some organisations, that would be frowned upon - or simply not possible (e.g. one generally can't go around modifying corporate databases).

Fair enough, but that's why we have word-processors, etc., where one can store notes (which in this case require little more than a quick copy/paste) for things we don't use very often. Doubtless you have something such already for Excel...
Thank you Sir. I appreciate the response!

Kevin
Reply With Quote
  #9  
Old 12-07-2013, 08:35 PM
macropod's Avatar
macropod macropod is offline How to Suppress non-monetary 0 Windows 7 32bit How to Suppress non-monetary 0 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Another good reason for using field switches is that their use makes the formatting in the Word document independent of the formatting in the Excel workbook. For example, you might have numbers without thousands separators in Excel, but want them to show in the Word document; or you might want to differentiate between +ve and -ve values by colour - something you can't do via any kind of formatting at the Excel end. With dates, you might want to have day-of-week, date & month only, whereas Excel hold date, month & year, or you might want the date to appear in one format at one location and in another format somewhere else. All of this can be achieve via field switches in Word, with no changes to the datasource.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Suppress non-monetary 0 Suppress blanks in mail merge 0nyx175 Mail Merge 11 01-07-2014 02:45 PM
How to Suppress non-monetary 0 Easy mail merge but want to suppress rows ClaireAMAdams Mail Merge 5 04-30-2013 02:43 PM
How to Suppress non-monetary 0 How to auto add up the sum of monetary values? mikehende Excel 6 10-13-2012 12:40 AM
How to Suppress non-monetary 0 Suppress the Save prompt UTSUPPORT Word 1 01-16-2012 09:27 PM
Suppress Dialog Box crutch024 Word 0 08-17-2010 09:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:29 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft