Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 09-19-2018, 07:41 AM
Yarikh Yarikh is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2018
Posts: 6
Yarikh is on a distinguished road
Default Mail merge: remove empty rows when a field is not showed

Hello everybody.
I have a problem with the creation of a list with mail merge.

I have to translate an archival inventory from excel to word.
The colums of my table can be divided into two kinds: the ones that are always needed, and the optional ones. Also I need to put a label before certain fields.

For exemple:
ID, title, year, collocation are present in every record.
Content, notes are present only when needed.
_______
I created the template with mail merge using the IF function, so that when the optional fields are not empty it is showed "Label: blah blah blah", and when said fields are empty nothing is showed (not even the label).

My problem is that when a field is empty, it remains an empty row I would like to remove. Here an example:

ID: 1
Title: Human resources
Content: personal dossiers of the employees.
Note: Reserved informations.
Year: 2000

ID: 2
Title: Paid bills
[HERE I FIND AN EMPTY ROW]
[HERE I FIND AN EMPTY ROW]
Year: 2001


I would like my second record to appear:



ID: 2
Title: Paid bills
Year: 2001


_______
I attach some file so you can better understand the problem.

Thanks a lot!
Attached Files
File Type: xlsx DB.xlsx (11.3 KB, 7 views)
File Type: docx Merge template.docx (14.1 KB, 8 views)
File Type: docx Result.docx (29.0 KB, 4 views)
Reply With Quote
  #2  
Old 09-19-2018, 02:48 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,199
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
Default

Instead of:
{ IF { MERGEFIELD Titolo }<> "" "{ MERGEFIELD Titolo }" "" }¶
use:
{MERGEFIELD Titolo \f "¶
"}

where ¶ is the actual paragraph break. Do the same with { MERGEFIELD Contenuto }

Similarly, instead of:
{ IF { MERGEFIELD Note_alla_datazione }<> "" "Note alla datazione: { MERGEFIELD Note_alla_datazione }" "" }¶
use:
{ IF { MERGEFIELD Note_alla_datazione }<> "" "Note alla datazione: { MERGEFIELD Note_alla_datazione }¶
"}

This is all discussed in the Mailmerge Tips and Tricks 'Sticky' thread at the top of this forum: http://www.msofficeforums.com/mail-m...ps-tricks.html
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 09-22-2018, 08:55 AM
Yarikh Yarikh is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2018
Posts: 6
Yarikh is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Instead of:
{ IF { MERGEFIELD Titolo }<> "" "{ MERGEFIELD Titolo }" "" }¶
use:
{MERGEFIELD Titolo \f "¶
"}

where ¶ is the actual paragraph break. Do the same with { MERGEFIELD Contenuto }

Similarly, instead of:
{ IF { MERGEFIELD Note_alla_datazione }<> "" "Note alla datazione: { MERGEFIELD Note_alla_datazione }" "" }¶
use:
{ IF { MERGEFIELD Note_alla_datazione }<> "" "Note alla datazione: { MERGEFIELD Note_alla_datazione }¶
"}

This is all discussed in the Mailmerge Tips and Tricks 'Sticky' thread at the top of this forum: http://www.msofficeforums.com/mail-m...ps-tricks.html
I'm sorry, maybe I'm really dumb, but I don't understand.
I tried to follow what you wrote and also read the tips&tricks topic, but I cant' obtain what I need: things remain the same, or worse, I create one more break line.

I think my problem is I need to use labels (which have to disappear when the field is ampty) and IF rules all toghether.

Can you explain better what I have to do or even better give me the correct version of my template?

Thanks so much!
Reply With Quote
  #4  
Old 09-22-2018, 04:22 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,199
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
Default

If you need to skip entire labels, you should apply a mailmerge filter with the required criteria, which you do via Mailings|Edit Recipient List>Filter.

As for the field coding I described, see the attached.
Attached Files
File Type: docx MailMerge Main Document.docx (17.3 KB, 9 views)
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 09-23-2018, 12:17 AM
Yarikh Yarikh is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2018
Posts: 6
Yarikh is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
If you need to skip entire labels, you should apply a mailmerge filter with the required criteria, which you do via Mailings|Edit Recipient List>Filter.

As for the field coding I described, see the attached.
Oh my!
Thanks, thanks, thanks! The solution was quite obvious, after all...

I was doing wrong because I was leaving the line break after the fields instead of deleting it and writing them right after the previous.

So I was writing:
{IF{MERGEFIELD Titolo}<> "" "{MERGEFIELD Titolo}¶
"}
{IF{MERGEFIELD Contenuto...


Instead f:
{IF{MERGEFIELD Titolo}<> "" "{MERGEFIELD Titolo}¶
"}{IF{MERGEFIELD Contenuto...


No comment please.

I just used the same trick also for the "Vecchia segnatura" and "Note alla vecchia segnatura", and everything was perfect.

Thanks again!
Reply With Quote
Reply

Tags
if rule, mail merge

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating badges using mail merge and do not want to supress lines with empty fields johnmorabito Mail Merge 1 04-25-2018 02:33 PM
Delete All empty Rows - Print - Undo all Rows deleted Bathroth Word VBA 1 10-01-2014 01:40 PM
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
Mail Merge Empty Data Field Licos101 Mail Merge 2 04-10-2014 06:19 AM
How to ignore a mail merge field if the field is blank redzan Mail Merge 1 05-16-2013 08:34 AM


All times are GMT -7. The time now is 09:39 AM.


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