• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Microsoft Excel Tips and Tricks - Computergaga

  • Home
  • Excel Online Courses
  • Excel Functions List
  • Free Downloads
  • Blog
  • Tutorials
  • About
Home / Office / Mail Merge Rule with Multiple Conditions

Mail Merge Rule with Multiple Conditions

Mail Merge can handle conditional rules such as If… Then… Else… to display different text depending on the information in the data source record.

Normally these rules are quite simple tasks such as; if the member joined within the last month, or if they have a family membership.

Sometimes though you may need to use multiple conditions. For example, you may want to check if a member of a club had a Gold, Silver or Bronze membership. The new price of their membership depends on what membership they have.

Begin by inserting a basic If… Then… Else… rule. This gives you a head start with typing the rules by inserting the structure of the condition. It’s easier to expand on this rule, than write one from nothing.

  1. Click on the Rules button in the Write & Insert Fields group of the Mailings tab
Mail Merge rules
  1. Select If… Then… Else… from the list
  2. Build the condition by selecting the Field name and  Comparison operator from the lists and then typing the value you want to check against in the Compare to box
  3. Type the text you want to show if the condition is true in the Insert this text box
Creating an If... Then... Else... Mail Merge rule
  1. Click Ok

The text will show in the document if it matches the condition for the first record from the data source.

To expand on this criteria we need to see the field code. Press Alt + F9 to view the field code. The code will look like below;

{ IF { MERGEFIELD Membership } = “Gold” “66” “” }

To use multiple conditions, you can add more If’s to the code. The example below shows the different amounts being displayed for the different types of membership.

{ IF { MERGEFIELD Membership } = “Gold” “66” { IF { MERGEFIELD Membership } = “Silver” “55” { IF { MERGEFIELD Membership } = “Bronze” “46” } } }

Pressing Alt + F9 at any point will switch between showing the field codes or not.

Reader Interactions

Comments

  1. ted hartwell says

    5 February 2013 at 1:29 pm

    this is all well and good but what about the other rules.
    Several sites I visited only explain the if then statement.
    What do the other rules do and how do I properly use them. That was what i was really looking for.

    Reply
  2. Kishor says

    22 August 2013 at 6:41 am

    How to insert another merged field in IF..Then..Else, Please guide.

    Reply
    • computergaga_blog says

      23 August 2013 at 9:02 pm

      Hi Kishor,
      Check out this link for inserting merge fields into an If Then Else statement.

      Reply
      • Emma K says

        27 January 2018 at 2:38 pm

        Link not working 🙁

        Reply
        • computergaga says

          4 February 2018 at 6:44 am

          Thanks Emma. Yes, that link in the comments area was to a page on the office.microsoft website. It is no longer available. Thanks for letting me know.

          Reply
  3. James says

    13 July 2020 at 8:59 pm

    How do I add say two combined conditions? IF A and B then C, otherwise blank?

    Reply
    • Alan Murray says

      23 July 2020 at 7:50 pm

      I’m not sure if doing more complicated conditions is possible James. It could be something that can e done in the VBA side.
      But this is going beyond the requirements of Word, and can probably be added as a column the the data source that you merge with. The Excel spreadsheet or database query. Better to to add the column there than in Word.

      Reply
    • Michael Bracken says

      20 November 2020 at 3:47 pm

      { IF { MERGEFIELD First-Item } = “A” “{ IF { MERGEFIELD Second-Item } = “B” “C” “” }” “”}

      Reply
  4. Carolee Moreno says

    5 July 2022 at 3:51 pm

    Can you tell me how to make this statement eliminate the blank lines upon merging? If I have a value in the merge file, I want it to just leave that item blank and eliminate the line on the merged document and move on to the next line. I have ten of these statements like the one below but can’t get rid of the white space if the second if statement has a value in the table.

    {IF {MERGEFIELD Bulletin_Board} = “” “Join the Bulletin Board” {IF {MERGEFIELD “Bulletin_Board} = “Bulletin Board User” “¶
    }}

    So, if mergefield is empty, I want it to show “join the bulletin board”, but if the mergefield already has a value in it, I do not want it to show the value, but rather do nothing and eliminate the white space on the merged document.

    Reply
  5. Stacey Coleman says

    11 November 2022 at 9:47 pm

    What is the best way to find the extra spacing between paragraphs in your merged letter. The rules are fine but I can’t find the extra spaces.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Recent Posts

  • Excel SWITCH Function – Nested IF Function Alternative
  • Sum Formulas Only in Excel
  • How to Calculate Age in Excel
  • Custom Sort in Excel
  • Case Sensitive Lookup with XLOOKUP in Excel
Advanced Excel Success book

Footer

Contact

[email protected]

LinkedIn Twitter YouTube

Useful Links

  • Home
  • Excel Online Courses
  • Tutorials
  • Sitemap
  • Privacy Policy
  • Jobs by Jooble

Course Topics

  • Blog
  • Charts
  • Courses
  • Dashboards
  • Downloads
  • Excel Tips
  • Formulas
  • Mail Merge
  • Office
  • PivotTables
  • Power BI
  • Power Pivot
  • Power Query
  • VBA

Join Our Mailing List

© Copyright 2009 Computergaga · All Rights Reserved ·