Mail Merge Percentage Format Syntax Error

I have prepared a mail merge between excel and word. One of the fields in excel is supposed to b percentage but was showing as 0.76 after merge. I put the following in its corresponding mergefield in the word template: {={MERGEFIELD fieldname}*100\#0%}.

This fixed the problem and it shows it a 76% after merge. However, it give error (!Syntax Error, *) if the cell in excel is blank. How do I suppress this error so that it leaves the mergefield result blank if data source has blank cell?

Thanks for the help.

 

Question Info


Last updated December 7, 2018 Views 7,726 Applies to:
Answer

To eliminate the errors, you would have to use

{ IF { Mergefield FieldName}  <> "" { ={ Mergefield FieldName } * 100 \# "0%" } " " }

If you want 0% to appear where the field is blank, use

{ IF { Mergefield FieldName}  <> "" { ={ Mergefield FieldName } * 100 \# "0%" } "0%" }


Hope this helps.

Doug Robbins - Word MVP,
dkr[atsymbol]mvps[dot]org
Posted via the Community Bridge

"WissamK" wrote in message news:*** Email address is removed for privacy ***...

I do the merge by calling a VBA code (i.e. clicking a command button) on an excel sheet.  The merge is working well with the fix suggested by you, but it now creates 2 documents: one that has the actual merge letters, and another called (Mail Merge Error1) that lists the errors, like "A field calculation error occurred in record 1". The only error is related to the above fix (if I not include the above field in the prepared merge word template, then the Mail Merge Error1 document does not appear. Is there a way to not have this Mail Merge Error1 appear? Thanks.


Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
Hope this helps,
Doug Robbins - Word MVP
dougrobbinsmvp@gmail.com
Screen shots by Snagit from www.techsmith.com

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Answer
How about
{ IF { ={ Mergefield FieldName} * 100 } <> "!Syn*" "{ ={ Mergefield
FieldName } * 100 \# "0%" }" }
 
 
--
 
 
 
 

Graham Mayor - Word MVP
www.gmayor.com
Posted via the Communities Bridge
http://communitybridge.codeplex.com/
Graham Mayor (Microsoft Word MVP)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.