'Conditional formatting' is a feature of Excel, doesn't exist in Word. So if you have to use the feature of Excel in Word, then you can try embedding (copy the table in excel now open the Word doc and try Paste Paste Special select Microsoft Excel Worksheet Object ok). IF statements allow you to compare two values and display document content based on the result of the comparison. When used in a Word template, IF fields are.
- Conditional Formatting In Word Table
- Conditional Formatting In Word Mail Merge
- How To Use Conditional Formatting In Word
- Conditional Formatting In Word Table
For full instructions on how to create conditional text using Microsoft Word, see Gary Calwell’s article in Words, volume 3, issue 2, May 2011, available here. Conditional Formatting in Microsoft Excel 2007/2010/2013/2016/2019 Ribbon. If you do not have Classic Menu for Office, and have never used Microsoft Excel 2007/2010/2013/2016/2019 Ribbon before, it may be a little difficult to find out the “Conditional Formatting” button quickly in the completely new Ribbon at the beginning. It seems my conditional formatting posts have become quite popular and with that, I’ve had some amazing questions asked about variations of how to use conditional formatting. If you haven’t already taken a look at my other conditional formatting posts, be sure to explore how to use conditional formatting with dates based on a range,.
You may be familiar with Conditional Formatting in Excel. Well, Conditional Formatting can also be applied to fields in Word.
Now, Word does not have a Conditional Formatting button like in Excel, but you can write an IF function in the field and format the true and false responses. This will create the perfect Conditional Formatting behaviour.
In this example, Mail Merge is being used to inform members of how many points they have earned this week. If the number of points is greater than 20, I want the number formatted in red, and if not formatted in black.
The name of the Mail Merge field we need to edit is number.
Inserting an IF Function to a Word Field
To write the IF function, we first need to see the field code. To do this, press Alt + F9 on the keyboard. This will toggle the field codes of your document.
The document will look like below with field codes shown instead of the field enclosed in chevrons such as <<number>>.
Click inside the field code to edit it.
The structure of the IF function is shown below. It is enclosed in curly braces and begins with the expression or condition, then the action to take if true and then the action to take if false.
To get the IF function to conditionally format the number in our Mail Merge we need to edit the field code to the below.
You do not type the curly braces. It will not work if they are typed. They must be entered by pressing Ctrl + F9.
Conditional Formatting with Mail Merge
When entering the IF function, format the true text and false text as you want them to appear. This could be a different colour, bold, underlined, larger. Whatever you need.
The end result of our document is shown below with field codes visible. The true text is red, with the false text left with the automatic black, and if you want to insert a signature in a digital document you could use services from as soda pdf to be able to do this.
Watch the Video
More Awesome Word Tutorials
Related Posts:
Conditional Formatting In Word Table
Word templates introduced in CRM Online and CRM 2016 are not the easiest contraptions to edit. One of the questions that popped up in a recent conversation was how to use conditional IF in the document generation.
tl;dr
To refer to the control values after the document has been generated, wrap content controls using bookmarks defined at the control container level.
Longer
CRM fields are defined as Content Controls and in theory we could have written some simple VBA using ContentControl object. Except that CRM does not play nice when generating the document and simply replaces all content controls with the record values.
The solution is to wrap the content controls using the bookmarks defined at the container level, i.e. cell, row, paragraph, etc. Then this bookmark can be used as a reference in a conditional expression of the IF field.
Conditional Formatting In Word Mail Merge
For example, to insert conditional text depending on the total invoice value:
How To Use Conditional Formatting In Word
- Extract the Invoice template that comes with the sample data and save it under a different name.
- Open the template, find total amount, select the entire table cell and click Insert > Bookmark.
- Type totalbookmark as a bookmark name, click Add.
- Delete the words “Thank you for your business” and click Insert > Quick Part > Field.
- Select IF field and type the following field code:
IF totalbookmark > 100 “Thank you for you business!” “Thanks for nothing!” - Click OK. Hint: to see and edit field codes in the document, press Alt-F9.
- Save the file and upload to CRM as a new template.
- Create an invoice and generate the invoice document.
- Enable document for editing, press Ctrl-A to select the entire content and press F9 to refresh the field content
- Depending on the total value of the invoice, the document will say “Thank you for your business!” or “Thanks for nothing!”
Conditional Formatting In Word Table
It’s not a full automation that potentially could be improved with some VBA (I’m not 100% sure if it will work) but it’s a step in the right direction and a cheap way to add some pizazz to your documents.