+ Reply to Thread
Results 1 to 12 of 12

Sum differences in row values in Excel 2016

  1. #1
    Registered User
    Join Date
    08-11-2011
    Location
    Louisiana
    MS-Off Ver
    Excel 2016 & 365
    Posts
    39

    Sum differences in row values in Excel 2016

    Hello,

    I'm trying to show the total weight lost in a work group competition since the last weigh-in.

    I cannot figure out how to add all of the weight lost by each individual without creating a column to do so.

    I tried an array with ={X4:X35-K4:K35} which didn't give the correct value.

    Sum differences between relative values of the above ranges without having to explicitly use =sum(x4-k4,x5-k5, etc). I hope this makes sense. I'm unable to post HTML code.
    Last edited by cajunlibra; 08-23-2017 at 12:38 PM. Reason: Version of software

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,882

    Re: Sum differences in row values

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a description of one and nobody wants to have to recreate your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-11-2011
    Location
    Louisiana
    MS-Off Ver
    Excel 2016 & 365
    Posts
    39

    Re: Sum differences in row values

    -39.2 is the value calculated.

    Attached is the data. My goal is sum(Current Weight - Last Weight)
    Attached Files Attached Files

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum differences in row values

    Try

    =SUMPRODUCT(B2:B18-A2:A18)

  5. #5
    Registered User
    Join Date
    08-11-2011
    Location
    Louisiana
    MS-Off Ver
    Excel 2016 & 365
    Posts
    39

    Re: Sum differences in row values

    Quote Originally Posted by Jonmo1 View Post
    Try

    =SUMPRODUCT(B2:B18-A2:A18)
    Yes. That did it. It also counted a blank/empty cell as 0 though. is there a way to modify it to account for blank cells?

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum differences in row values

    What would you want it to do with blanks if not treat them as 0 ?

  7. #7
    Registered User
    Join Date
    08-11-2011
    Location
    Louisiana
    MS-Off Ver
    Excel 2016 & 365
    Posts
    39

    Re: Sum differences in row values

    Ignore them. If Bx is blank but Ax has a value, the formula reports a large negative number.

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Sum differences in row values in Excel 2016

    Do you need to test both columns for blank, or only B ?

    This would test only B
    =SUMPRODUCT(--(B2:B18<>""),B2:B18-A2:A18)

    If you need to test both A and B
    =SUMPRODUCT(--(A2:A18<>""),--(B2:B18<>""),B2:B18-A2:A18)

  9. #9
    Registered User
    Join Date
    08-11-2011
    Location
    Louisiana
    MS-Off Ver
    Excel 2016 & 365
    Posts
    39

    Re: Sum differences in row values in Excel 2016

    Quote Originally Posted by Jonmo1 View Post
    Do you need to test both columns for blank, or only B ?

    This would test only B
    =SUMPRODUCT(--(B2:B18<>""),B2:B18-A2:A18)

    If you need to test both A and B
    =SUMPRODUCT(--(A2:A18<>""),--(B2:B18<>""),B2:B18-A2:A18)
    Thank you. Very helpful. Do you have a suggestion on where I could find a good, simple explanation on how this function works? I've seen it used multiple times and there are a few formulas that do what I need them to do but I do not understand how they do what they do(helpful folks online either shared it or had a tutorial). I'm not an Excel novice but some of these formulas seem to be really complicated.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,882

    Re: Sum differences in row values in Excel 2016

    If you use the evaluate formula feature on the formulas ribbon to step through the formula as it calculates, you will see what it is doing. It's a useful way of working out how these things do what they do.

  11. #11
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Sum differences in row values in Excel 2016

    there are many out there https://www.ablebits.com/office-addi...mula-examples/

    for example

    the main thing to know is that if a logical expression is worked out it produces a list of true and false, however if these values have a mathematical operation performed on them they become 1 or 0



    so sumproduct(--(a1:a10>2)) is the same as sumproduct((a1:a10>2)*1) or sumproduct((a1:a10>2)+0)

    they are just ways of turning true and falses into numbers

  12. #12
    Registered User
    Join Date
    08-11-2011
    Location
    Louisiana
    MS-Off Ver
    Excel 2016 & 365
    Posts
    39

    Re: Sum differences in row values in Excel 2016

    Thank you. Sometimes the evaluate feature doesn't always help in explaining how a function works. I do often use the Formula wizard to build formulas and make sure i have the correct formula and it's doing what I want it to. I'll check out that link.
    Last edited by AliGW; 07-04-2018 at 06:54 AM. Reason: Unnecessary quotation removed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Formula to calculate, then sum, the differences between multiple values
    By Feby0900 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-22-2017, 01:03 PM
  2. Problem with cell values outside their absolute differences
    By CooperHawke in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-01-2016, 01:15 AM
  3. Replies: 9
    Last Post: 03-31-2016, 06:24 PM
  4. Replies: 0
    Last Post: 04-13-2015, 01:01 PM
  5. Formula to calculate time differences but not all cells have values?
    By claudiamariep in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-21-2014, 03:23 PM
  6. differences in cell values
    By sdts in forum Excel General
    Replies: 2
    Last Post: 07-02-2011, 04:05 AM

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