Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Merge from Excel Spreadsheet 3

Status
Not open for further replies.

keenanbr

Programmer
Oct 3, 2001
469
IE
I am using an excel spreadsheet to populate a Mail merge document. What i would like to do is if a certain value on the spreadsheet is not zero display some text along with this value. Is this possible. Any help appreciated.

Regards
 


Hi,

Try using an <If...Then...Else> Word Field on your Mail Merge Toolbar.

Skip,

[glasses] [red]Be Advised![/red] The only distinction between a bird with one wing and a bird with two, is merely...
a difference of A Pinion! [tongue]
 
Thanks. That helps, but it's not quite what I want to do. If the value is zero the merge field is displaying.
 



"...if a certain value on the spreadsheet is not zero display some text along with this value."

Is this not what you asked for?

Trouble is, MailMerge is a BLACK BOX: you start it; you get the results.

There's an FAQ on doing Mail Merge in Excel. There, you CAN do Conditional Formatting.

Mail Merge in Excel faq68-4223

Skip,

[glasses] [red]Be Advised![/red] The only distinction between a bird with one wing and a bird with two, is merely...
a difference of A Pinion! [tongue]
 
Hi keenanbr,

In your Word mailmerge document, click on the errant mailmerge field and press Shift-F9. This should expose the field code, which will look something like:
{MAILMERGE ExcelData}
to supress 0 output, add a numeric picture switch to the field, thus:
{MAILMERGE ExcelData \# ,0;-,0;}
For dollars and cents, you could use:
{MAILMERGE ExcelData \# $,0.00;-$,0.00;}

The numeric picture switch works similarly to cell formatting in Excel, with three parameters - +ve values, -ve values and 0 values, each separated by a semi-colon. The lack of anything after the second semi-colon suppresses 0 outputs.

If your mailmerge is inline with text in your document and you also want to suppress the extra space that a suppressed 0 would leave behind, use something like:
{MAILMERGE ExcelData \# ",0 ;-,0 ;"}
or
{MAILMERGE ExcelData \# "$,0.00 ;-$,0.00 ;"}
and omit the space after the mailmerge field - it will put it's own in for non-zero values.

Cheers

[MS MVP - Word]
 
Thanks. A combination of these replies solved my problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top