SUM not Providing the Correct Sum

Written by Allen Wyatt (last updated March 8, 2025)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365


1

Bob has a simple formula that relies on the SUM function to total the 10 cells immediately above it. However, SUM doesn't seem to be returning the correct total. If Bob places 5 in each of the 10 cells, the SUM should be 50, but it only returns 35. Bob cannot figure out why he can't get the right sum with such a simple formula.

The first thing to check is that the SUM function is actually referencing all the cells in the range. You can easily figure this out by selecting the cell that contains the formula and then pressing F2. This puts Excel into edit mode, but it also highlights any cell ranges referenced within the formula. Make sure that the entire range of ten cells is highlighted. If it isn't, then adjust the formula to encompass the full range.

If the full range is being referenced, then the problem is probably related to the formatting of cells within the range. If some of the cells within the range are formatted as text—meaning, they were formatted as text before anything was in the cell—then they will be ignored by SUM, even if they contain a number.

This should be easy to figure out, though Excel's behavior can be a bit erratic. As an example, I placed, in cell H12, the following formula:

=SUM(H1:H10)

Then, I formatted cells H3, H6, and H8 as text. Next, starting in cell H1, I entered the value 5 in each cell, one cell at a time. I stopped before putting anything into cell H10. (See Figure 1.)

Figure 1. Entering data in the cells.

You can see that the three cells I formatted as text (H3, H6, and H8) are stored as left-justified text with the small, green corner triangle that lets you know there is something different about the cells. You can also see that I had entered 5 nine times, but the sum in H12 is 30, meaning that the SUM function recognized six numbers and three text values in the range. Finally, you can also see that cell H10 (the selected cell) is formatted as General.

Next, I typed 5 and pressed Enter. Then, I pressed the Up Arrow once to get back to cell H10. However, something funny had happened. (See Figure 2.)

Figure 2. After entering cell H10.

Notice that the cell is now formatted as text and is left-justified, but there is no small, green corner triangle, and the value in cell H10 is included in the sum shown in cell H12—even though the cell is supposedly formatted as text!

When I entered the value in cell H10, Excel apparently noticed that cell H6 was formatted as text, cell H8 was formatted as text, and so to continue the every-other-cell pattern, it automatically formatted cell H10 as text.

This illustrates that Excel actually has two apparent ways to format a cell as text—either before entry or after entry. If I went back up to cell H4 and formatted it as text, with the value 5 already in there, then the value is left-justified, but the small, green triangle does not appear and the value is still included in the H12 sum. This is what happened with cell H10, which means that Excel considered that cell to be formatted as text post-entry, not pre-entry.

To make matters even messier, if I go back to one of my three cells that were formatted as text pre-entry (H3, H6, or H10), a small warning icon appears to the left of the cell. If I hover the mouse over that icon then I can click the down-arrow and see several different ways I can modify the cell contents. One of those options is "Convert to Number," which changes the cell formatting to General and makes the cell into a numeric value that is recognized by the SUM function.

It should be noted that this is the most efficient method of converting the text number into an actual number. If, instead, you simply format the cell using a numeric format (such as General), then Excel still treats the cell contents as text, even though the cell is not formatted as text. The solution at this point is to simply press F2 and Enter. This forces Excel to "re-parse" the cell contents and, since the cell uses a numeric format, it starts treating it as a number.

Another option in the icon drop-down list, though, is "Ignore Error." If you chose this option, then Excel gets rid of the small, green triangle and leaves the cell as text. At this point, the cell looks just like a numeric cell, but it is still left-justified. Of course, that justification could easily be changed by using the formatting tools on the Home tab of the ribbon, at which point it is much more difficult to tell that the cell is actually being treated as text.

This illustrates a very important concept—you cannot understand how Excel is interpreting a cell based solely on how the cell appears. You cannot even understand how Excel is interpreting the cell based on selecting the cell and looking at the Number Format drop-down list on the Home tab of the ribbon. If you really want to know how Excel is treating the cells, then you need to do the following:

  1. Display the Excel Options dialog box. (In Excel 2007 click the Office button and then click Excel Options. In Excel 2010 or a later version, display the File tab of the ribbon and then click Options.)
  2. At the left side of the dialog box, click Formulas. (See Figure 3.)
  3. Figure 3. The Formulas area of the Excel Options dialog box.

  4. Under the Error Checking heading, click the Reset Ignored Errors option.
  5. Click OK to dismiss the Excel Options dialog box.

At this point, any cells containing numbers but that had been formatted as text pre-entry will display the small, green triangle. It is these cells that you need to pay attention to and convert to actual numbers instead of text.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (9632) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Excel in Microsoft 365.

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

Converting Numbers to Strings

VBA is great at working with both strings and numbers. At some point you may have a number you need to convert to a ...

Discover More

Single-Use Drop-Down List

Want to create an easy drop-down list? You can do so by using the data validation features of Excel.

Discover More

Limiting Searching to a Column

When you use Find and Replace, Excel normally looks through all the cells in a worksheet. You may want to limit the ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Finding the Date Associated with a Negative Value

When working with data taken from the real world, you often have to determine which certain conditions were met, such as ...

Discover More

Selecting Random Names

Got a ton of names from which you need to select a few random names? There are several ways you can extract what you ...

Discover More

Counting Displayed Cells

When you filter data, Excel displays only a portion of what is really in a worksheet. If you want to count the number of ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, 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}] (all 7 characters, in the sequence shown) 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 four more than 9?

2025-03-08 08:20:18

jamies

even more fun when Excel functions, and the equivalent VBA tests ,gives results such as both tests

IF(H10="5","True,""False")
and
IF(H10=5,"True","False")
not being "True"

as may
IF(or((H10=H9),(H10=H8),"True","False")

but testing 0+H10 gives "True"

Not - actually tested that against the tip example, but experienced it with data in a worksheet sent to me.


This Site

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

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, 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.