Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-09-2018, 01:22 PM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default Remove Empty Line while using If MergeField Function

This is my "code":



( if (MERGEFIELD Chicken) = "0" "" "1")

however, if it is indeed 0.. an empty line is created.. I want to delete the line automatically...

help?
Reply With Quote
  #2  
Old 07-09-2018, 04:15 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,249
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

See Mailmerge Empty Line Suppression 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 07-10-2018, 06:16 AM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default

It doesn't work the b/ or f/ trick. Let me rephrase, maybe I'm doing a mistake.

Basically I am using a If MergeField.

( If ( MERGEFIELD VRedAge1 ) = "0" "MERGEFIELD VRedAge1 \b "
")" "Benefit Reduction" )

Is that how it should be written? It seems not to work. Basically, when VRedAge1 = 0, I want it to delete the line. If it is not 0, I want it to insert Benefit Reduction.

Thank you in advance
Reply With Quote
  #4  
Old 07-10-2018, 08:28 AM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default

I also tried

( If ( MERGEFIELD VRedAge1 ) = "" "MERGEFIELD VRedAge1 \b "
")" "Benefit Reduction" )

and when I merge.. there's an empty line.. help me
Reply With Quote
  #5  
Old 07-10-2018, 04:31 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,249
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

You really should pay attention to what the instructions in the link say to do. You need a field coded as:
{IF{MERGEFIELD Chicken}<> "0" "1¶
"}
where ¶ is a real paragraph break or line break.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #6  
Old 07-11-2018, 01:45 PM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default

Please go to the following link:

https://i.imgur.com/RAicsh1.png

when RedAge1 is indeed 0, it creates an empty line.. I tried your trick it doesn't work..?

also even if I type it {IF{MERGEFIELD Redage1}<> "0" "Reduction de la prestation¶
"}

in 2 lines like you instead of 3 in my screenshot.. there's still an empty line!

I read your thread indeed and I couldn't get it.. Could you help me figure it out?
Reply With Quote
  #7  
Old 07-11-2018, 03:58 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,249
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

You said you wanted to delete an empty line - not a table row. The two are entirely different and you cannot delete a table row that way. What you would need is two versions of the table (one with all rows, one without the variable one) inside an IF field that tests your Redage1 content.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #8  
Old 07-11-2018, 05:11 PM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default

Im so sorry lol didnt know it was specifically a table row. So it would be something like this:

If Redage1 is 0, "show table row without Reduction de la prestation table row", "show table with Reducation de la prestation".

However, I have an issue. I have to test like redage1 until redage10. do I need to do 11 tables (1 table with no reduction, 10 tables (one reduction, 2 reduction, 3 reduction,... 10 reductions) ? That would be crazy... Basically I work in benefits in my firm and our table can show up to 10 reductions for a benefit. Could you confirm this?

Any faster way to get it done?
Reply With Quote
  #9  
Old 07-11-2018, 05:42 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,249
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

Quote:
Originally Posted by stevenel View Post
didnt know it was specifically a table row.
The '¤'symbols in your screenshot indicate a table's end-of-cell or end-of-row marker.
Quote:
Originally Posted by stevenel View Post
I have to test like redage1 until redage10. do I need to do 11 tables (1 table with no reduction, 10 tables (one reduction, 2 reduction, 3 reduction,... 10 reductions) ? That would be crazy... Basically I work in benefits in my firm and our table can show up to 10 reductions for a benefit. Could you confirm this?
If those all appear in the same table row, that's not an issue, since you could use the same technique I already provided:
{IF{MERGEFIELD Redage1}<> "0" "Text for Redage1¶
"}{IF{MERGEFIELD Redage2}<> "0" "Text for Redage2¶
"}{IF{MERGEFIELD Redage3}<> "0" "Text for Redage3¶
"}¤
Otherwise, you could split your table so that each variable row is a separate table.
{IF{MERGEFIELD Redage1}<> "0" "¶
Table for Redage1¤
"}{IF{MERGEFIELD Redage2}<> "0" "¶
Table for Redage2¤
"}{IF{MERGEFIELD Redage3}<> "0" "¶
Table for Redage3¤
"}
with the paragraph breaks preceding the tables made as small as possible (1pt).
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #10  
Old 07-11-2018, 05:44 PM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default

Will it still work if the Text for RedAge1 is a mergefield?
Man you're amazing, I gotta thank you a lot.
Reply With Quote
  #11  
Old 07-11-2018, 05:45 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,249
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

Yes, the conditional output can include mergefields, tables, pictures, etc.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #12  
Old 07-11-2018, 05:47 PM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default

Could you stay online for 10 mins? I am currently logging by distance on my computer work. Let me try it out thanks so much
Reply With Quote
  #13  
Old 07-11-2018, 06:21 PM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default

http://oi67.tinypic.com/246pfls.jpg

Please look at my screenshot. Here's my issue.

On the left part, where red arrow is pointed, only one sentence is supposed to be shown: Réduction de la prestation which means Benefit Reduction in english.
On the right part, I show the benefit reductions (from 0 to 10). If there are 5 benefit reduction for 5 specific ages, then I need 5 rows on the right that say the reductions and 5 empty line "rows" that dissapear (because i have 10 mergefields on the right part that you see on the screenshot).

Should I be doing 11 tables (one table that has no benefit reduction, the other 10 being a table with one reduction, a table with two reduction, etc...)?

Could you confirm? Cause I have trouble understanding your post.
Reply With Quote
  #14  
Old 07-11-2018, 06:46 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,249
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 posting images on other sites, from where they're liable to disappear, then posting links here, please post them here, which you can do via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.

If you want a table without any of the 'Reduction de la prestation' row to appear when {MERGEFIELD Redage1}= 0, then you'll still need to have at least two tables. It would also be much easier to help you if you attached the actual document to a post instead of screenshots...
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #15  
Old 07-11-2018, 06:50 PM
stevenel stevenel is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jul 2018
Posts: 17
stevenel is on a distinguished road
Default

I uploaded here and included the merge excel file.

I'm sorry lol, Im not familiar with this forums template yet! I'll be better.
Attached Files
File Type: docx Master - Garanties.docx (24.9 KB, 3 views)
File Type: xlsx VieMerge2.xlsx (8.3 KB, 5 views)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking specific cells in Excel to function with MergeField? Fabulist Word 0 02-17-2016 02:19 AM
Centering a mergefield under a signature line nfotx Mail Merge 2 08-31-2015 09:25 PM
Can you prevent an empty line from appearing in the first line of a page? New Daddy Word 10 11-18-2013 07:01 AM
Remove empty lines at the top of every page dexter30 Word VBA 2 08-05-2013 08:37 PM
How to remove that pesky empty Page widescreenforever Word 1 11-28-2012 02:49 PM


All times are GMT -7. The time now is 06:10 AM.


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