When it comes to performing calculations in a Word document, we tend to think of embedding or linking an Excel worksheet — but this can be overkill. Sometimes, a better approach is simply to insert a table in a document and perform the calculations in it. Word tables have a number of applications: staffing rotas, timetables, pricing charts, quotations, and the one I use most, invoices.

It’s easy to create an invoice that includes your business details, contact information, and logo, along with a table that itemizes the costs, parts, and labor; automatically calculates the totals and taxes; and presents a total amount payable. You can even include Fill-in fields to automatically prompt for customer information. Once you set up this invoice framework, save the blank form as a template, and you’re in business.

To generate an invoice, you just create a new document using the template, fill in the customer information, and enter the invoice amounts in the table. You can then update the fields that calculate tax and totals and print the invoice. To help you get started, I’ve created a sample invoice template that you can customize to fit your needs. Let’s look first at some template-building basics; then, I’ll explain how to modify and use my sample template.

Laying out the heading

The first step in building an invoice template is to design the heading you want to use for it. Once you’ve created a heading, save it so you can use it for other marketing material, such as flyers, price lists, and announcements.

AutoText tip

One convenient way to preserve an element such as a heading is to save it as AutoText. Just select the items that make up your heading and press [Alt][F3]. When Word presents the Create AutoText dialog box, enter a name and click OK. Then, whenever you need to insert the heading in a document, just position the insertion point marker where you want the heading to appear and type the AutoText name. By default, Word will offer to auto-complete the name, and you can press [Enter] to insert the heading. If this feature is turned off, just type the AutoText name and press [F3].

Creating the body of the document

Think about the wording you’re going to use in your invoice. Be careful not to fall into grammatical errors that can make you and your business look unprofessional. In my template, I used an automatic Date field so that each invoice I create from the template will be correctly dated.

Planning and inserting the table

When you’re ready to add the table to your template, display the Tables And Borders toolbar. As with the other toolbars available in Word, you can switch on this one from View | Toolbars. Most of the table options can be reached from this toolbar.

Decide how many rows and columns you need in your table. You can always insert extra rows, but it is nice to start out with something you don’t need to alter too much. Once you have planned the layout, click on the Insert Table button. You will see a dialog box where you can select the number of columns and rows in your new table.

Entering the calculations

Look at the Tables And Borders toolbar. There’s a funny symbol at the bottom-right. This is the AutoSum button. By clicking in an empty cell below a column that will contain values, you can use this button to perform simple addition. When you click AutoSum, Word will insert the function { =SUM(ABOVE) }.

Should you wish to add a calculation for sales tax or VAT (UK), insert a formula field. First, click in the next cell down and choose Field from the Insert menu. Then, click the Formula button and enter a multiplication expression. For instance, to apply a 4 percent sales tax, enter the formula =B6*1.04 , as shown in Figure A.

Figure A

The formula multiplies the total, which, in this example, is in cell B6, by 1.04. You can alter this formula for use in your locality by changing the figure after the * symbol. For example, to apply the UK rate of sales tax (VAT, or Value Added Tax) of 15 percent, your formula would be =B6*1.15.

The cells in a Word table work in the same way as those of an Excel worksheet. The drawback is that the table does not display column and row labels. Remember that the columns are represented by letters, from left to right: A,B,C, etc. The rows are numbered from the top down. Figure B shows a table with those labels superimposed, to help you visualize this layout.

Figure B

Saving the template

When you save your invoice document, remember to save it as a Word template, with a .dot file extension. (Go to File | Save As and choose Document Template (*.dot) from the Save As Type drop-down list.) This will make it available from the File | New command.

Modifying the sample template

To put my sample invoice template to work, first open it and replace the heading and company information with your own. (To open the template for editing instead of creating a new document, you’ll need to right-click on it and choose Open.)

You might find it useful to work with field codes displayed so that you don’t accidentally delete any fields. You can toggle the display on and off for the entire document by pressing [Alt][F9]. Figure C shows the sample template with field codes displayed. Notice the Fill-in fields that prompt for an invoice number and customer information. Nice to have, but not essential when you create your own template.

Figure C

You may need to alter the calculation to reflect your own rate of tax, as discussed earlier. You may also want to modify the Fill-in field prompts to ask for different customer data. For instance, you might prompt for town, county, and post code rather than city, state, and zip code. With field codes displayed, simply edit the text that appears in quote marks within the Fill-in fields.

After you’ve modified the template, save it in the desired folder. If you want it to be listed with other templates when you create a new document, be sure to place it in your default location for templates.

Putting the sample template to work

When you want to raise an invoice for your personal services, open a new document using this template, fill in the customer information at the prompts, and enter the appropriate invoice charges. Select the table and press [F9] to update your calculations. Then, save and print the document and send it to your client. You can also copy the data into reminder letters, should your client fail to settle an account promptly.

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays