Document Editing Problems

Use a Word Mail Merge IF Rule for Blank First Names

Algirdas JasaitisAlgirdas Jasaitis Nov 20, 2026 869 views

Question details

Create a mail merge greeting that uses a recipient's first name when available and a general greeting when it is blank.

Use a Word Mail Merge IF Rule for Blank First Names
Product
Microsoft Word
Device & OS
not provided
Scenario
A Word mail merge uses a recipient list in which some first-name entries are empty.
Observed behavior
The desired greeting is personalized for recipients with a first name and uses a general salutation for recipients without one.
Before you start

Connect the Word document to your recipient list through Mailings > Select Recipients. Check the exact name of the first-name column and identify records with and without a value for testing.

Solution 1Recommended

Insert an IF field for personalized and general greetings

Use this field in the greeting area to choose a salutation based on whether the first-name merge field is empty.

The IF field compares the first-name value with an empty string. If it is not empty, Word uses the personalized greeting; otherwise, it uses the general greeting.

1
Insert the outer field

Place the cursor where the greeting should appear. In Word for Windows, press Ctrl+F9 to insert field braces, then type IF inside them.

2
Add the first-name fields

Inside the outer braces, create both MERGEFIELD fields with Ctrl+F9 and enter the expression so it reads: { IF "{ MERGEFIELD First_Name }" <> "" "Dear { MERGEFIELD First_Name }," "To Whom It May Concern," }. Replace First_Name with the exact field name from your recipient list.

3
Update and preview

Select the outer field and press F9 to update it. Use Alt+F9 to toggle field codes if needed, then choose Mailings > Preview Results and navigate through records with populated and blank first names.

4
Complete the merge

Once both greetings display correctly, choose Mailings > Finish & Merge and select the output you need.

Insert an IF field for personalized and general greetings
Use Word's field braces: Do not type the braces with the keyboard: each pair must be inserted as a Word field. The shortcuts shown are for Word on Windows.
Free Microsoft Office alternative

Edit Word documents with WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and Word format compatibility for an easy move between suites. It does not fix Word's IF field behavior; check conditional mail merge fields before completing a merge in another application.

Open and edit Word documents, including mail merge templatesCompatible with Microsoft Word DOC and DOCX formatsFamiliar editing interface for users moving from Microsoft OfficeFree and lightweight for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

How do I show the IF field code in Word?

In Word for Windows, press Alt+F9 to toggle between field codes and their displayed results.

What if my first-name column has a different name?

Replace First_Name in both MERGEFIELD entries with the exact field name from your recipient list. Check the available names under Mailings > Insert Merge Field.

How can I check both versions of the greeting?

Choose Mailings > Preview Results, then use the record navigation controls to view at least one recipient with a first name and one with a blank first name.

Why does my field code appear as ordinary text?

Word needs actual field braces rather than braces typed as characters. In Word for Windows, use Ctrl+F9 for each pair of braces, then select the outer field and press F9.