Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Summing Absolute Values.

Summing Absolute Values

by Allen Wyatt
(last updated May 16, 2017)


Joseph has a worksheet that contains a list of values. Some of those values are above zero and others are below. He can use the SUM function to calculate a sum of the values, but he really wants to calculate a sum of the absolute value of each item in the list. So, the sum of the three values -33, 14, -5 would be 52 instead of -24.

There is no intrinsic function you can use to create the desired sum, but you can create a formula to perform the task. One method is to use the SUMIF function, in the following manner:


The first SUMIF sums all the values that are greater than zero, and the second sums all those less than zero. Thus, with the four values -33, 14, -5, 42, the first SUMIF would result in a sum of 56 (14 + 42) and the second would result in a sum of -38 (-33 + -5). When you subtract the second sum from the first (56 - -38) you get a final answer of 94, which is the sum of all the absolute values.

Another approach is to use the SUMPRODUCT function. The following formula will produce the desired result:


The function is typically used to multiply different elements of arrays by each other, and then sum those products. Since only one array (A1:A10) is provided, there is no multiplication done, but a sum of the desired absolute values is returned.

You can also get the desired result by using an array formula, a convenient but seldom used feature of Excel. Assuming your values are in the range A1:A10, type this formula:


Don't press Enter; instead press Ctrl+Shift+Enter, which signifies this is an array formula. If the formula is entered correctly, you'll see braces around the formula in the Formula bar:


What the formula does is internally create the intermediate column (which is an array of values) which are the individual absolute values of A1:A10. It then sums this array and displays the result.

Finally, if you prefer you could create your own user-defined function (a macro) that will return the sum of the absolute values in a range. The following is a macro that will accomplish this task:

Function SumAbs(Rng As Range) As Double
    Result = 0
    On Error GoTo Done
    For Each element In Rng
        Result = Result + Abs(element)
    Next element
    SumAbs = Result
End Function

You can use the function by entering a simple formula in your worksheet:


ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12615) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Summing Absolute Values.

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. ...


Keeping Tables on One Page

Need to make sure that your smaller tables stay on a single page? Here's a handy trick you can use to enforce this rule.

Discover More

Displaying the First Worksheet in a Macro

When creating macros, you often have to know how to display individual worksheets. VBA provides several ways you can ...

Discover More

Conditionally Formatting for Multiple Date Comparisons

When you compare dates in a conditional formatting rule, you need to be careful how you put your comparisons together. Do ...

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)

Checking for Either of Two Text Values

Using a formula to find information in a text value is easy. Using a formula to find either of two text values within a ...

Discover More

Adjusting Test Scores Proportionately

Teachers often grade on what is affectionately referred to as "the curve." The problem is, it can be a bit difficult to ...

Discover More

Number of Terms in a Formula

Formulas are made up of operands that separate a series of terms acted upon by the operands. You may want to know, for ...

Discover More

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

View most recent newsletter.


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 five less than 8?

2017-05-17 03:38:40



My formula is correct. If you look at the original comment by Steve D, his expected total is 5, which is delivered. If you change the + to -, you get 27.

The only values in the list of seven that are greater than 5 or less than -5 are the last three, namely 9, 7 and -11. Adding them gives 16 minus 11 which is 5. Subtracting them gives 16 minus minus-11, which is 27.

2017-05-16 10:50:16


The formula's in Dave's comment should be "-" (subtraction) operations, not "+" (addition), as the 2nd SUMIF will return a negative result.

2017-05-16 06:53:55


That's a very elegant solution provided by Micky Avidan. If, like me, you haven't got to grips with SUMPRODUCT, you can always use the following longer, but possibly easier to read, formula:

=SUMIF(A1:A7,">5",A1:A7) + SUMIF(A1:A7,"<-5",A1:A7)

As with many formulae, you could put the value 5 into a cell and replace the 5 by the cell reference (e.g. B1) in the formula. Then it's very easy to change the threshhold and see the total change to suit. So my formula would become:

=SUMIF(A1:A7,">"&B1,A1:A7) + SUMIF(A1:A7,"<-"&B1,A1:A7)

2014-11-25 05:28:08

Michael (Micky) Avidan

@Steve D,
Try: =SUMPRODUCT((ABS(A1:A7)>5)*A1:A7)
Michael (Micky) Avidan
“Microsoft® Answers" - Wiki author & Forums Moderator
“Microsoft®” MVP – Excel (2009-2015)

2014-11-24 18:27:25

Steve D

Hi Allen,

How would I sum values that are positive or negative but ONLY if the absolute value of the entry is larger than another number?

Say I have the numbers 1,5,-4,-5,9,7,-11

I only wish to add those numbers where the absolute value is > 5, say. So I would add 9+7-11 = 5. How to do this automatically?

Many thanks in advance!

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

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.