Monday, November 24, 2008

Not enough (or too many) decimals showing in a Microsoft Word mail merge

If you use Microsoft Word's mail merge feature, you may have had problems with decimal places in the past when using something such as an Excel spreadsheet as your data source. If you couldn't figure out how to fix it, give this a try. You can specify how many decimals to show using a parameter within the mail merge field, but it's not exactly out in the open. In order to do this go through the normal Mail Merge process with the wizard and add your fields to the whatever it is you're creating. Now, once the fields have been specified, go to your document and press Alt+F9 to show the field codes. You'll see the data placeholders change to something like 

{MERGEFIELD "datafield"}

Now, find your problematic decimal field and use the '\#' switch (add a space after your data field) so it looks like

{MERGEFIELD "datafield" \#}

Now add another space and here's where you can specify your number format. If you want to have 2 decimals, use "0.0x". For three decimals, use "0.00x". Four is "0.000x" and so on. I'll show the 2 decimal example

{MERGEFIELD "datafield" \# 0.0x}

After you have that specified, go ahead and press Alt+F9 again to go back to the normal data field view. When you preview it, the data should now appear formatted as you specified.

I found the info in an post, which you can find here. I also found an entry on, which is here in KB320473, but the article was much more useful

No comments: