Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

LinkBack Thread Tools Display Modes
Old 05-08-2014, 10:32 AM
dsummers dsummers is offline Mac OS X Office for Mac 2011
Join Date: May 2014
Posts: 1
dsummers is on a distinguished road
Default Mail merge how to link mail merge field value to a column heading

Hi, I'm creating some labels for delivery boxes and thought that mail merge would be the way forward. My labels contain i) the delivery details (name, address, postcode) and ii) the names of the items in the box and the volume.

I have managed to achieve this but, in the example attached, where I have '0' volume for a particular box item I don't want that item to be displayed at all, e.g. in the bread section if 'Fig & Red Wine' is '0' then I want to find a way of not returning the hardcoded text.

I've tried fiddling around with IF statements and switches but can't get anything to work. Is there a way of inserting the column headings as merge fields and then making their appearance contingent on the existence of values other than 0 in my data?

Your help would be greatly appreciated.

Kind regards
Attached Files
File Type: xlsx Mailmerge source data test 2.xlsx (47.9 KB, 10 views)
File Type: docx Mailmerge test doc 2.docx (93.6 KB, 5 views)
Reply With Quote
Old 05-08-2014, 02:59 PM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,663
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold

To do this, you would have to redesign your document so that each row in the sub-tables is a separate table in its own right and embed that one-row table in a field coded along the lines of:
{IF{MERGEFIELD Fig__Red_Wine}> 0 "|Fig & Red Wine|{MERGEFIELD Fig__Red_Wine}|"}
where the '{}' represent the field brace pairs and the '|' represents the left/right cell borders.

Along the same lines, if you want to suppress the headings also when all rows for a sub-table are empty, you'd need to embed that in a field coded along the lines of:
{IF{={IF{MERGEFIELD Fig__Red_Wine}= 0 0 1}+{IF{MERGEFIELD Rustic_French}= 0 0 1}+{IF{MERGEFIELD MultiSeed}= 0 0 1}+{IF{MERGEFIELD Focaccia}= 0 0 1}}> 0 "|Bread|"}
Paul Edstein
[MS MVP - Word]
Reply With Quote

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
mail merge using data from column A as placeholder. keys Mail Merge 2 10-31-2013 01:55 AM
How to ignore a mail merge field if the field is blank redzan Mail Merge 1 05-16-2013 08:34 AM
How big can a mail merge field be? Engineer Mail Merge 2 12-11-2012 01:20 AM
Mail Merge / DSN / Data Link / MySQL Bob Young Mail Merge 5 05-18-2012 03:44 PM
Mail Merge Anchoring column layouts HWSpencer Mail Merge 0 04-25-2008 06:08 AM

All times are GMT -7. The time now is 05:48 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc. is not affiliated with Microsoft