Thursday, July 30, 2009

MS Word Mail Merge - Date and Numeric format

I use MS Word Mail Merge function quite often in my HR operational projects that target a big group of employee/customer. For example is greeting card.

Common problem that user facing with mail merge is date and numeric format. With 2 mins, your problem should resolve follow the 4 step guide.

For example:

Assume you have excel worksheet with date, brithday and age column, and using MS Word document mail merge function to generate word document.

Date : 《Date》
Birthday : 《Birthday》
Age : 《Age》

Press 《ABC》 button you get this format

Date : 7/14/2009
Birthday : 10/3/1954
Age : 54.834999487886847


The solution as follow:-

Step 1 - Press Alt + F9, you should see your mail merge document show as below

Date : {MERGEFIELD "Date"}
Birthday : {MERGEFIELD "Birthday"}
Age : {MERGEFIELD "Age"}

Step 2 - add date and numeric format highlighted in RED color

Date : {MERGEFIELD "Date" \@"dd-MMM-yyyy"}
Birthday : {MERGEFIELD "Birthday" \@"dd-MMM-yyyy"}
Age : {MERGEFIELD "Age" \@# #0}

Step 3 - Press Alt + F9 again, you should get back to this format

Date : 《Date》
Birthday : 《Birthday》
Age : 《Age》

Step 4 - Press 《ABC》 button again, you should see this result

Date : 14/Jul/2009
Birthday : 3/Oct/1954
Age : 55


FYI, if you want a decimal point, you can use \@# #0.0, the word document should display 54.8 in age column.


No comments:

Post a Comment