SOLVED

Mail Merge and IF ""

Steel Contributor

Hello,

I am a novice user and dont have much experience with mail merge. 

I have poked around on the internet for how to use the IF in mail merge.

 

What I want to do:

Hide a field and the related text if the field it is blank.

 

Below is what I have and in preview results it does seem to hide if SWIFT is "" but when I unclick the preview results I no longer see the fields there.  They are completely gone and I dont know how to bring it back.  

{ IF «SWIFT» <>"" SWIFT: «SWIFT» }

How do I bring back the fields?  

 

I also need to remove that row completely IF "" and think I might need to add /b possibly? I also read that there could be a conflict with \b and IF so I am not sure about how to remove the line completely so there are no blank rows

 

Note: I have read that you have to follow certain steps and can not type in teh chevrons or the brackets (must hit Control F9 to wrap in brackets).  For the <> I am simply typing it in and assume that is the way to do it. 

 

 

Grateful for the help. 

6 Replies

@Tony2021 I assume that you have used CTRL+F9 to insert the field delimiters and that you have used ALT+F9 to toggle off their display.  When the field codes are not displayed, you will not see anything unless you use the Preview Results facility.

To have it so that the paragraph does not appear, set up your document as shown below:

 

[Text of preceding paragraph.{ IF «SWIFT» <>""¶

SWIFT: «SWIFT»" }¶

 

[Text for following paragraph.]  

 

Press the Enter key where the pilcrows (¶) appear in the above field construction.

 

@Doug_Robbins_Word_MVP 

Hi Doug and thank you for the response. 

I want to make sure I am doing this correct. 

 

I press enter key as instructed but I dont see that paragraph character anywhere and when I preview the blank space is still there. 

 

here is a screen shot:

The yellow shade is where the field that will be hidden when ""

Tony2021_0-1646101767466.png

Here is the output.  You can see the space where the SWIFT is ""

Tony2021_1-1646101906903.png

 

@Tony2021 Turn on the display of non-printing characters by clicking on the Pilcrow button in the Paragraph section of the Home tab of the ribbon.

 

The following shows the field construction that you require:

 

Doug_Robbins_Word_MVP_0-1646108954111.png

 

 

@Doug_Robbins_Word_MVP 

HI Doug, thank you for the response. I have a follow up.
Wouldnt the above put the Account No and SWIFT on the same line if they are both NOT "" ?
I followed as described and it seems to be the case.  I think we are on the right path but I am probably not following but maybe a little more info will help. 


I am needing a separate line for each field and if "" then push the one below up into that space. I hope it makes sense. 

thank you very much.

 

below yellow shaded is what I edited it to based on response above:

Tony2021_3-1646134717153.png

 

Notice that I have a SWIFT line below it that performs as intended but only if its "" then I need it to be removed completely and the ABA below it to be pushed up into its place and therefore no spaces between Account No and ABA if swift was "". I hope it is not confusing. 

 

here is the output for that yellow shaded line above (No and SWIFT are on the same line)

 

thank you Doug.  Looking forward to your response.  

 

 

best response confirmed by Tony2021 (Steel Contributor)
Solution

@Tony2021 The field construction that you are using is NOT the same as the one in my response

 

Doug_Robbins_Word_MVP_0-1646164302481.png

It will create new lines for the SWIFT and\or ABA if those fields contain data.

 

 

I have good news. It worked! I didnt notice the extra brackets in your original post and it took awhile to learn how to put the backs of the brackets next to eachother. It was pretty tedious work indeed with control F9. My brain is tired now. Thank you for the expert assistance and hanging in with me. I learned something new. Have a good night.
1 best response

Accepted Solutions
best response confirmed by Tony2021 (Steel Contributor)
Solution

@Tony2021 The field construction that you are using is NOT the same as the one in my response

 

Doug_Robbins_Word_MVP_0-1646164302481.png

It will create new lines for the SWIFT and\or ABA if those fields contain data.

 

 

View solution in original post