Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Houston, TX, USA
    Posts
    33
    Thanks
    2
    Thanked 0 Times in 0 Posts

    MailMerge Issue (Word 2003 )

    Using Excel for data source, I have one row per client. Each row has 14 fields (Dollars). Not all fields have an amount. All CAN, but as it stands, all do not. Some rows have only one. The document has wording, and then lists text for the fields that are greater than 0 and then the field value. After the last field, a total is produced (all aligned by decimal tab).

    The issue is I would like to only produce the total line if there are more than one field listed. It looks stupid to show one line, and then a total below it. How would I count the number of items printed ( fields > 0) to then place the total line and value?

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: MailMerge Issue (Word 2003 )

    I'd add a column to the Excel data source that counts the number of non-blank entries per row, using a formula like =COUNT(A2:M2).
    You can then use Insert Word Field from the Mail Merge toolbar to insert an If ... Then ... Else ... field that displays the total only if the count field is greater than 1.

  4. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,818
    Thanks
    0
    Thanked 167 Times in 154 Posts

    Re: MailMerge Issue (Word 2003 )

    Hi PCGeek,

    You can do this in Word using an IF field, coded along the lines of:
    {IF{MERGEFIELD Val2}<> 0 {={MERGEFIELD Val1}+{MERGEFIELD Val2}+{MERGEFIELD Val3}+{MERGEFIELD Val4}+{MERGEFIELD Val5}}}
    or, if the empty fields return blanks instead of 0s in the mailmerge:
    {IF{MERGEFIELD Val2}<> 0 "{SET Val1 {MERGEFIELD Val1}}{SET Val2 {MERGEFIELD Val2}}{SET Val3 {MERGEFIELD Val3}}{SET Val4 {MERGEFIELD Val4}}{SET Val5 {MERGEFIELD Val5}}{=Val1+Val2+Val3+Val4+Val5}"}
    where Val1 through to Val5 in the mergefields are your actual Excel data field names.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •