Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 09-19-2017, 01:32 PM
LearningMom LearningMom is offline Windows Vista Office 2007
Novice
 
Join Date: Feb 2015
Posts: 5
LearningMom is on a distinguished road
Default Nesting Merge Fields

I have tried various methods to nest merge fields and only the first one appears and in all of them not even the correct description. I have googled and can't fine one nesting formula that works. I even copied the a formula in a document that works and put my merged fields and it doesn't work. I know I am just missing seeing the issue. Can someone look at my formula and see if you can tell what the issue is. Please note I am using CTRL F9 for brackets but I can't copy paste so I am rewriting it here.

{IF{MERGEDFIELD Fund_description_1} = "" "2017 Fund_Arts" "ARTS" "{IF{MERGEDFIELD Fund_description_1} = "" "2017 Fund _Athletics" "ATHLETICS" "
{IF{MERGEDFIELD Fund_description_1} = "" "2017 FUND_Financial Aid" "FINANCIAL AID" ""}"}"}



This is just a sample I have 7 that I have to put into the letter.

Thank you
Reply With Quote
  #2  
Old 09-19-2017, 01:54 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,352
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 behold
Default

It's not clear from what you've posted whether there are actually seven different variation of the text you want to output. You field coding suggests you want "2017 Fund_Arts" to appear if the field is empty, and "ARTS" otherwise, which you can achieve via:

{IF{MERGEFIELD Fund_description_1} = "" "2017 Fund_Arts" "ARTS"}

However, I suspect you actually intended to substitute "ARTS" in the output, as in:

{IF{MERGEFIELD Fund_description_1} = "2017 Fund_Arts" "ARTS"}

and, likewise:

{IF{MERGEFIELD Fund_description_1} = "2017 Fund _Athletics" "ATHLETICS"}
{IF{MERGEFIELD Fund_description_1} = "2017 FUND_Financial Aid" "FINANCIAL AID"}

If so, there is no need to nest any of the fields, though you can do so if you really want to. You could just insert them one after the other:

{IF{MERGEFIELD Fund_description_1} = "2017 Fund_Arts" "ARTS"}{IF{MERGEFIELD Fund_description_1} = "2017 Fund _Athletics" "ATHLETICS"}{IF{MERGEFIELD Fund_description_1} = "2017 FUND_Financial Aid" "FINANCIAL AID"}

Nested, they'd become:

{IF{MERGEFIELD Fund_description_1} = "2017 Fund_Arts" "ARTS" {IF{MERGEFIELD Fund_description_1} = "2017 Fund _Athletics" "ATHLETICS" {IF{MERGEFIELD Fund_description_1} = "2017 FUND_Financial Aid" "FINANCIAL AID"}}}

Hint: So that you don't have to change the field codes every year, you might consider deleting the year identifiers from the fields in the data source. Alternatively, you could code the fields like:

{IF{MERGEFIELD Fund_description_1} = "???? Fund_Arts" "ARTS"}{IF{MERGEFIELD Fund_description_1} = "???? Fund _Athletics" "ATHLETICS"}{IF{MERGEFIELD Fund_description_1} = "???? FUND_Financial Aid" "FINANCIAL AID"}
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 09-20-2017, 01:11 PM
LearningMom LearningMom is offline Windows Vista Office 2007
Novice
 
Join Date: Feb 2015
Posts: 5
LearningMom is on a distinguished road
Default

I am afraid that doesn't work. The first one is appearing in all of the letters no matter what fund they donated to. To clarify a bit more I hope, If the fund equals one of the seven funds they can donate to, special wording about that fund will be inserted into the letter, it won't say the word ART etc, I just wanted to keep it simple for the test. Unfortunately, I can't not put the year this is technically a tax receipt with an acknowledgement piece attached.
Reply With Quote
  #4  
Old 09-20-2017, 03:20 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,352
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 behold
Default

It should work! Can you attach your mailmerge main document to a post (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 09-21-2017, 09:59 AM
LearningMom LearningMom is offline Windows Vista Office 2007
Novice
 
Join Date: Feb 2015
Posts: 5
LearningMom is on a distinguished road
Default

I hope I attached the file correctly, I did not see a paperclip or the Go Advance tab. I have tried several ideas I found from adding spaces before the = before and after the IF, space before after " or removing " in areas. There are tons of suggestion but nothing seems to work. I feel I have stared at this for so long that I might have inputted or removed a crucial piece.

Thank you
Attached Files
File Type: docx Nesting Test.docx (25.4 KB, 5 views)
Reply With Quote
  #6  
Old 09-21-2017, 05:14 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,352
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 behold
Default

Are you actually completing the merge, or just previewing it? Previews don't give a reliable indication of the output when you nest fields as you have done.

I note, too, that you have a standard DATE field in your mailmerge main document. You should embed that in a QUOTE field so the date gets locked when the merge is executed; otherwise it'll update every time you open the output document, See Convert Mailmerge Date Fields to Plain Text in the Mailmerge Tips and Tricks 'Sticky' thread at the top of this forum:
http://www.msofficeforums.com/mail-m...ps-tricks.html
While there, you should also look at the Mailmerge Empty Line Suppression topic.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 09-22-2017, 05:36 AM
LearningMom LearningMom is offline Windows Vista Office 2007
Novice
 
Join Date: Feb 2015
Posts: 5
LearningMom is on a distinguished road
Default

Yes, I have completed the mail merge each time. I rewrote the whole formula again and it still only produces the first one "ARTS". I have to say writing code in other programs seems much simpler.
Reply With Quote
  #8  
Old 09-22-2017, 03:09 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,352
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 behold
Default

I've tracked the problem down to the presence of the year # in the IF test. You can overcome that by replacing 2017 with ????, as in:
{IF{MERGEFIELD Fund_description_1} = "???? Fund_Arts" "ARTS"}{IF{MERGEFIELD Fund_description_1} = "???? Fund _Athletics" "ATHLETICS"}{IF{MERGEFIELD Fund_description_1} = "???? FUND_Financial Aid" "FINANCIAL AID"}
or:
{IF{MERGEFIELD Fund_description_1} = "???? Fund_Arts" "ARTS" {IF{MERGEFIELD Fund_description_1} = "???? Fund _Athletics" "ATHLETICS" {IF{MERGEFIELD Fund_description_1} = "???? FUND_Financial Aid" "FINANCIAL AID"}}}
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #9  
Old 09-25-2017, 05:35 AM
LearningMom LearningMom is offline Windows Vista Office 2007
Novice
 
Join Date: Feb 2015
Posts: 5
LearningMom is on a distinguished road
Default

Thank you, that seems to work. The big question is why?

I am going to apply this to other programs to see how they react.

Thanks again for sticking with this, much appreciated.
Reply With Quote
  #10  
Old 09-25-2017, 01:44 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 16,352
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 behold
Default

Quote:
Originally Posted by LearningMom View Post
Thank you, that seems to work. The big question is why?
I suspect it's because, when the formula saw the 2017 in the IF test, it treated the whole thing as if it was looking for just the number. Replacing the 2017 with ???? causes Word to look at the rest of the expression as well.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply
Please reply to this thread with any new information or opinions.

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merge fields merge incorrectly and won't fix. marym Mail Merge 3 04-09-2016 05:17 AM
Displaying FORMTEXT fields when merge fields are empty or null sfkHooper Mail Merge 6 01-19-2016 04:24 PM
Nesting and IF & AND statement lynchbro Excel 4 04-16-2015 11:39 AM
merge fields disappear in merge doc but prints mdod Word 1 07-19-2013 06:33 PM
Nesting Variables SET, LISTNUM, and REF Wyskers Word 1 11-13-2011 05:43 AM


All times are GMT -7. The time now is 03:02 AM.


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