SOLVED

Mail Merge and IF ""

%3CLINGO-SUB%20id%3D%22lingo-sub-3219205%22%20slang%3D%22en-US%22%3EMail%20Merge%20and%20IF%20%22%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3219205%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3EI%20am%20a%20novice%20user%20and%20dont%20have%20much%20experience%20with%20mail%20merge.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20poked%20around%20on%20the%20internet%20for%20how%20to%20use%20the%20IF%20in%20mail%20merge.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I%20want%20to%20do%3A%3C%2FP%3E%3CP%3EHide%20a%20field%20and%20the%20related%20text%20if%20the%20field%20it%20is%20blank.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBelow%20is%20what%20I%20have%20and%20in%20preview%20results%20it%20does%20seem%20to%20hide%20if%20SWIFT%20is%20%22%22%20but%20when%20I%20unclick%20the%20preview%20results%20I%20no%20longer%20see%20the%20fields%20there.%26nbsp%3B%20They%20are%20completely%20gone%20and%20I%20dont%20know%20how%20to%20bring%20it%20back.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%7B%3C%2FSPAN%3E%26nbsp%3BIF%20%3CSPAN%3E%C2%ABSWIFT%C2%BB%20%26lt%3B%26gt%3B%22%22%20SWIFT%3A%26nbsp%3B%C2%ABSWIFT%C2%BB%26nbsp%3B%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHow%20do%20I%20bring%20back%20the%20fields%3F%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20also%20need%20to%20remove%20that%20row%20completely%20IF%20%22%22%20and%20think%20I%20might%20need%20to%20add%20%2Fb%20possibly%3F%20I%20also%20read%20that%20there%20could%20be%20a%20conflict%20with%20%5Cb%20and%20IF%20so%20I%20am%20not%20sure%20about%20how%20to%20remove%20the%20line%20completely%20so%20there%20are%20no%20blank%20rows%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ENote%3A%20I%20have%20read%20that%20you%20have%20to%20follow%20certain%20steps%20and%20can%20not%20type%20in%20teh%20chevrons%20or%20the%20brackets%20(must%20hit%20Control%20F9%20to%20wrap%20in%20brackets).%26nbsp%3B%20For%20the%20%26lt%3B%26gt%3B%20I%20am%20simply%20typing%20it%20in%20and%20assume%20that%20is%20the%20way%20to%20do%20it.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EGrateful%20for%20the%20help.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3219205%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWord%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3223510%22%20slang%3D%22en-US%22%3ERe%3A%20Mail%20Merge%20and%20IF%20%22%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3223510%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1029845%22%20target%3D%22_blank%22%3E%40Tony2021%3C%2FA%3E%26nbsp%3BI%20assume%20that%20you%20have%20used%20CTRL%2BF9%20to%20insert%20the%20field%20delimiters%20and%20that%20you%20have%20used%20CTRL%2BF9%20to%20toggle%20off%20their%20display.%26nbsp%3B%20When%20the%20field%20codes%20are%20not%20displayed%2C%20you%20will%20not%20see%20anything%20unless%20you%20use%20the%20Preview%20Results%20facility.%3C%2FP%3E%0A%3CP%3ETo%20have%20it%20so%20that%20the%20paragraph%20does%20not%20appear%2C%20set%20up%20your%20document%20as%20shown%20below%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%5BText%20of%20preceding%20paragraph.%3CSPAN%3E%7B%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BIF%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%C2%ABSWIFT%C2%BB%20%26lt%3B%26gt%3B%22%22%C2%B6%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ESWIFT%3A%26nbsp%3B%C2%ABSWIFT%C2%BB%22%20%7D%C2%B6%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%5BText%20for%20following%20paragraph.%5D%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EPress%20the%20Enter%20key%20where%20the%20pilcrows%20(%C2%B6)%20appear%20in%20the%20above%20field%20construction.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3223801%22%20slang%3D%22en-US%22%3ERe%3A%20Mail%20Merge%20and%20IF%20%22%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3223801%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1225189%22%20target%3D%22_blank%22%3E%40Doug_Robbins_Word_MVP%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Doug%20and%20thank%20you%20for%20the%20response.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20want%20to%20make%20sure%20I%20am%20doing%20this%20correct.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20press%20enter%20key%20as%20instructed%20but%20I%20dont%20see%20that%20paragraph%20character%20anywhere%20and%20when%20I%20preview%20the%20blank%20space%20is%20still%20there.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Ehere%20is%20a%20screen%20shot%3A%3C%2FP%3E%3CP%3EThe%20yellow%20shade%20is%20where%20the%20field%20that%20will%20be%20hidden%20when%20%22%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Tony2021_0-1646101767466.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F351921i27EC943646C4B2F6%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Tony2021_0-1646101767466.png%22%20alt%3D%22Tony2021_0-1646101767466.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EHere%20is%20the%20output.%26nbsp%3B%20You%20can%20see%20the%20space%20where%20the%20SWIFT%20is%20%22%22%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Tony2021_1-1646101906903.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F351922i30C2316BAA058D00%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Tony2021_1-1646101906903.png%22%20alt%3D%22Tony2021_1-1646101906903.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3223907%22%20slang%3D%22en-US%22%3ERe%3A%20Mail%20Merge%20and%20IF%20%22%22%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3223907%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1029845%22%20target%3D%22_blank%22%3E%40Tony2021%3C%2FA%3E%26nbsp%3BTurn%20on%20the%20display%20of%20non-printing%20characters%20by%20clicking%20on%20the%20Pilcrow%20button%20in%20the%20Paragraph%20section%20of%20the%20Home%20tab%20of%20the%20ribbon.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20following%20shows%20the%20field%20construction%20that%20you%20require%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Doug_Robbins_Word_MVP_0-1646108954111.png%22%20style%3D%22width%3A%20693px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F351927i8C756AD617A4D152%2Fimage-dimensions%2F693x279%3Fv%3Dv2%22%20width%3D%22693%22%20height%3D%22279%22%20role%3D%22button%22%20title%3D%22Doug_Robbins_Word_MVP_0-1646108954111.png%22%20alt%3D%22Doug_Robbins_Word_MVP_0-1646108954111.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Super 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 (Super 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.