+ Reply to Thread
Results 1 to 2 of 2

Sum of absolute values after the subtraction of digits in two columns

  1. #1
    Registered User
    Join Date
    06-17-2013
    Location
    Peoria
    MS-Off Ver
    Excel 2007
    Posts
    1

    Sum of absolute values after the subtraction of digits in two columns

    So, I have two columns of data and I'm trying to sum the absolute values of the differences of the corresponding digits in the rows.

    Note: I want to do this without adding an extra column of subtractions. I'm also aware of the SUMX2MY2 function which is good, but it squares each difference before summing them. I want to know if there's a way to use a similar sum function without squaring the differences initially.

    Example:

    __COL1__COL2

    A 12-------17

    B 5---------3

    C 10-------11

    The sum of the differences is -4 (-5+2+-1=-4), but I want to sum the absolute values of the differences which will get me 8 (|-5|+|2|+
    |-1|=8). I want to know if there's a formula that will get me to 8 without adding an extra column.

    Thanks everyone!

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Sum of absolute values after the subtraction of digits in two columns

    This array formula should do it:

    =SUM(ABS(A2:A4-B2:B4))

    ...confirmed by pressing CTRL-SHIFT-ENTER to activate the array. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL-SHIFT-ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1