Use a Word Mail Merge IF Rule for Blank First Names
Question details
Create a mail merge greeting that uses a recipient's first name when available and a general greeting when it is blank.

- 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.
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.
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.
Place the cursor where the greeting should appear. In Word for Windows, press Ctrl+F9 to insert field braces, then type IF inside them.
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.
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.
Once both greetings display correctly, choose Mailings > Finish & Merge and select the output you need.

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.

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.




