Should you run right into a conditional header or footer request which you could’t deal with, check out Phrase fields. They are not magic, however it seems like magic after they do what you need.

Illustration: Lisa Hornung, Getty Pictures/iStockPhoto

If somebody requested you so as to add a conditional header or footer to a doc in Microsoft Phrase, would you panic? Some customers may as a result of the interface presents no such possibility. You should use the Completely different Odd & Even Pages possibility, however that is not the identical factor. 

A conditional header or footer will show, or not, relying on whether or not an expression returns TRUE or FALSE. On this article, I will present you 3 ways to make use of fields to generate a conditional header or footer, though the examples will all be within the footer. 

SEE: 83 Excel ideas each person ought to grasp (TechRepublic)

I am utilizing Microsoft 365 on a Home windows 10 64-bit system, however you should use earlier variations. Phrase fields have been round for a very long time. This text assumes you’ve got fundamental Phrase expertise, however even a newbie ought to be capable to observe the directions to success. You possibly can obtain the demonstration .docx and .doc recordsdata, however I encourage you to follow getting into the fields your self. Phrase On-line would not show headers and footers; nor are you able to manipulate them. Nonetheless, they’re nonetheless there, and they’re going to print.

What’s a area in Phrase?

Should you’re conversant in Phrase fields, you are a step forward. If not, they don’t seem to be troublesome to make use of, however the course of may really feel a bit odd at first. Fields are little applications that full a particular job, just like a macro, however you need not write any code. Every part the sector must do its job is already there, apart from the data you provide. 

You utilize fields nearly each time you utilize Phrase, however you simply do not realize it. As an illustration, if you use the interface to show a web page quantity within the header or footer, you are utilizing a area! If you would like to see that at work, open a brand new doc and enter a web page quantity within the header. Then, choose the web page quantity and press Alt + F9. Phrase converts the web page quantity to its underlying { PAGE } area. On this mode, you possibly can modify the sector. Press Alt + F9, which acts as a toggle, once more to see the web page quantity. 

The expression to show on final web page of the Phrase doc

It is common to show a special header or footer on the primary or final web page of a doc. You should use the built-in Completely different First Web page choice to show a special header on the primary web page. There is no such possibility for the final web page; figuring out the final web page requires a easy area expression within the kind

{ IF {PAGE} = { NUMPAGES }, “true textual content””false textual content”}

It is easy to decipher: If the present web page quantity, { PAGE } equals the overall variety of pages, { NUMPAGES } print “true textual content”. If the 2 web page numbers do not match, the expression prints “false textual content”.

Let us take a look at a fast instance utilizing a three-page doc:

  1. Open the header or footer by double-clicking within the high or backside margin.
  2. Phrase will place the cursor on the left margin, which is okay.
  3. On this subsequent half, we’ll be getting into the fields manually, which I believe is the best approach to enter nested fields. To insert a clean area, press Ctrl + F9 and sort IF. (Case would not actually matter.) 
  4. Whereas nonetheless contained in the If area, press Ctrl + F9 a second time to enter a clean area and enter PAGE.
  5. Transfer the cursor to the proper of the closing } character within the { PAGE } area and enter =.
  6. Press Ctrl + F9 a 3rd time and enter NUMPAGES.
  7. Transfer the cursor to the proper of the closing } character within the NUMPAGES area and enter “Final web page””Not the final web page”.

Determine A exhibits the nested fields. Don’t enter the {} characters from the keypad; it will not work. You could enter the clean fields utilizing Ctrl + F9 and enter the content material inside these brackets. Now, choose all the nested area expression and press Alt + F9 to guage the outcomes (Determine A). As you possibly can see, the final web page is the present web page. 

Determine A


  Use a nested area expression to create a conditional header or footer.

I’ve proven you just one approach to enter fields, however there are different strategies. Earlier than we proceed, I wish to share one other approach to enter nested fields that you simply may discover simpler. You possibly can kind the sector identify, akin to IF or NAME, choose that identify and press Ctrl + F9. Doing so will convert IF or NAME to a area and insert the brackets.  

This easy expression works nice till you’ve got unnumbered pages in your doc. As an illustration, the doc may need a desk of contents or a title web page that you don’t need within the web page depend. When this occurs, you need to discover a approach to accommodate these pages. 

SEE: Home windows 10: Lists of vocal instructions for speech recognition and dictation (free PDF) (TechRepublic)

Should you’re excluding solely the primary web page, use the Completely different First Web page possibility. Doing so will inhibit a web page quantity, and Phrase will not embody that web page within the remaining web page depend. Excluding different pages may require a piece break or an expression that evaluates these pages. The next expression excludes a two-page part in the beginning of the doc that is not included within the whole web page depend:

{ IF {PAGE} = { NUMPAGES – 2 } , “Final web page””Not the final web page”}

The expression is sort of the identical as the primary, however the -2 element subtracts 2, the overall variety of pages you wish to exclude from the web page depend. 

If you’d like the expression to return nothing, use the empty string character, “”. For instance, the next nested area expression will return a string on the final web page and return nothing on all different pages:

{ IF {PAGE} = { NUMPAGES } , “””Not the final web page” }

Now let’s take a look at a situation that appears a bit extra complicated.

How you can specify web page numbers in a footer in Phrase

What occurs when you’ve got a footer that you simply wish to print solely on particular pages? You utilize the identical fields to precise the particular web page numbers and use the suitable true and false textual content. Let’s suppose that you simply wish to print a web page quantity solely on pages 5 and 6?

The issue solely appears extra complicated, however in fact, it is easier. As an alternative of a nested expression, use two expressions:

{ If {Web page } = “5””Web page 5″”” }

{ If {Web page } = “6””Web page 6″”” }

Determine B exhibits the web page quantity on web page 6.

Determine B


  Use two expressions to fulfill the pages 5 and 6 situation.

Each situations are easy to fulfill utilizing two totally different expressions as an alternative of a nested expression. Now, let’s take a look at one thing you may assume not possible utilizing fields.

How you can show a picture in a header or footer in Phrase

If requested for those who can show a conditional picture within the header or footer, you may reply, “No.” That is not appropriate. You deal with a picture the identical as some other textual content or worth. First, it’s essential to insert the picture file into the doc and reserve it as AutoText. Then, you insert the AutoText into the footer or header. 

First, let’s add TechRepublic’s brand to the doc as an AutoText component:  

  1. Insert the image into the physique of the doc (not a header or footer) as you’d some other picture file. 
  2. Choose the picture and click on the Discover Fast Elements dropdown. 
  3. Select Save Choice to Fast Elements Gallery.
  4. Within the ensuing dialog, give the picture a reputation, akin to TRLogo (see Determine C). 
  5. Click on OK. 

Determine C


  Title the picture one thing significant so it is easy to recall.

Now that you’ve got the picture as an AutoText merchandise within the doc, you possibly can insert it into the header as follows: 

  1. Place the cursor within the header or footer the place you need it to seem. 
  2. Utilizing Determine D as a information, enter the { IF } area as much as the primary ” character. 
  3. Click on the Insert tab. 
  4. From the Discover Fast Elements dropdown (Textual content group), select AutoText. 
  5. Choose the picture (Determine E) and click on OK. 

Determine F exhibits the brand within the footer, conditionally; it seems solely on the final web page due to the conditional area expression proven in Determine D.

Determine D


  Enter the sector expression as much as the brand picture. 

Determine E


  Choose TRLogo, the picture AutoText you beforehand added. 

Determine F


Fields are so versatile which you could even show a picture conditionally.

This introduction to displaying conditional content material, together with pictures, in a doc’s header or footer is just the start. You should use the next comparability operators: =, <>, <=, and >=. You’ve got discovered how one can nest fields, which is extraordinarily helpful. Nonetheless, even when you would use a nested expression, you do not all the time must, as proven within the second instance. Keep in mind to all the time use F9 to insert and modify fields. 

Keep tuned

I discussed earlier that there are extra methods to enter fields than the one I labored you thru within the first instance. A future article will embody all the methods to enter Phrase fields. 

Additionally see

Source link