Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Suppressing a Zero in a Calculated Sum.

Suppressing a Zero in a Calculated Sum

by Allen Wyatt
(last updated October 19, 2017)

3

Word allows you to create tables and to do a limited amount of math based on the cells in the table. Primarily, Word allows you to sum different cells; for instance, you can sum all the values in a particular column. Exactly how you do this has been covered in different issues of WordTips.

When calculating a sum, if the values that make up that sum total zero, then Word will show a zero in the cell where the summation formula is placed. In some instances you may want Word to simply leave the cell blank if the sum is zero. There are two ways you can achieve this goal.

First, you can use the picture switch with the SUM field to get exactly the type of numeric display you want. There are three possible settings you can use with the picture field, the first for the display of positive numbers, the second for the display of negative numbers, and the third if the number is zero. The following use of the SUM field illustrates this concept:

{ =SUM(ABOVE) \# "#,##0.00;(#,##0.00);''" }

This is, of course, a field code, so the outermost brackets are created by pressing Ctrl+F9. The \# switch indicates that everything following and enclosed with quote marks constitutes the formats to be used in displaying the field results. The three settings within the quote marks are separated by semicolons. Thus, the first setting, #,##0.00, indicates that you want positive results displays using two decimal places and commas between thousands. The second setting, (#,##0.00), indicates the same treatment for negative numbers, except that the result is surrounded by parentheses. The third setting, which consists of two apostrophes with nothing between them, indicates that if the result is zero, you want nothing displayed.

The second possible solution is to use a nested field for calculating the sum. In this case, you would use the IF field to determine if the sum was zero. If it is, then you display the sum, if not, then you display nothing. The following is the example:

{ IF { =SUM(ABOVE) } = 0 "" { =SUM(ABOVE) } }

When this nested field is calculated, Word first checks to see if the sum of the above cells is zero. If it is, then the contents of what is between the quote marks (nothing) is displayed. If it is not, then the actual sum is displayed.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (9770) applies to Microsoft Word 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Word here: Suppressing a Zero in a Calculated Sum.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Displaying Nonprinting Characters

Nonprinting characters are a great boon when you are editing a document. Turn them on and you can easily see what characters ...

Discover More

Controlling the Display of Toolbars

The various toolbars available in Excel are indispensable when it comes to easily accomplishing tasks. Here is a concise ...

Discover More

Always Printing Drawing Objects

Add a bunch of drawing objects to your document, and you may wonder how to make sure they all appear on a printout. How you ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Copying All Tables to a New Document

Need to make a copy of every single table in a document? There's a quick and easy way to do it using the macro in this tip.

Discover More

Creating and Using Standardized Tables

If you have a common table layout that you want to use again and again, you'd benefit by having an easy way to save that ...

Discover More

Displaying Table Gridlines

For those times when you remove the borders from your tables, Word provides a way that you can display non-printing ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 - 2?

2014-10-13 18:21:43

Philippe

Hi Allen,
I have a problem with Word 2013 :
The same word document with formula in table return the right values on some computers (say group A) and return zero on some others (say group B). Doing CTRL-A and F9 has always the same behavior :
Opened in group A, put zero everywhere.
Opened in group B, put the total.
Tested on 4 computers, 2 are working, two are not. Word 2013 Pro Plus 32 bits on all the computers.

Do you have any idea ?


2014-02-24 11:46:29

Morris Manning

Kay, there is a missing backsplash in your code. Suggest the following to demonstrate: create a one column, four row table. Put any numbers in first three cells. Highlight and copy the tip formula without the special brackets. Place cursor in cell four and press {Ctrl}{F9} to create special brackets. Paste copied forumla between brackets. Move cursor outside brackets and press {Enter}. The sum of your numbers will appear.


2013-07-24 11:58:00

Kay

I copied this formula -- { =SUM(ABOVE) # "#,##0.00;(#,##0.00);''" }
-- and pasted it into the formula field in Word, but a form field does not appear after I click OK. I've tried taking out the spaces and the brackets and receive a syntax error. Please help.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.