#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
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 [Fmr MS MVP - Word] |
#3
|
|||
|
|||
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.
|
#4
|
||||
|
||||
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 [Fmr MS MVP - Word] |
#5
|
|||
|
|||
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 |
#6
|
||||
|
||||
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: https://www.msofficeforums.com/mail-...ps-tricks.html While there, you should also look at the Mailmerge Empty Line Suppression topic.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
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.
|
#8
|
||||
|
||||
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 [Fmr MS MVP - Word] |
#9
|
|||
|
|||
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. |
#10
|
||||
|
||||
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 [Fmr MS MVP - Word] |
|
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 |