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.
Written by Allen Wyatt (last updated March 3, 2022)
This tip applies to Word 2007, 2010, 2013, and 2016
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.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
When you get information in your document "just right," you may want to make sure that others cannot change it. Here's a ...
Discover MoreIf you work with data imported from the Web or with documents prepared by others, you may have tables that have leading ...
Discover MoreExcel makes it very easy to add sequential numbers to a range of cells. Not so in Word's tables, where adding such ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-12-17 22:52:57
Jerome
Hi Allen,
This article was very useful for me. Actually, i would do many IF to check few conditions, but I found out it was not possible. I had to choose the most important condition. The header of the row is 2020-2021 wich give -1. That is why I decided to go with this option :
IF { =SUM(ABOVE) } = -1 "" { =SUM(ABOVE) \# "°0,00;(0,00);''"}
Thanks for your help,
Jerome
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments