+ Reply to Thread
Results 1 to 10 of 10

Adding the sum of cells that are the difference over a specific number

  1. #1
    Registered User
    Join Date
    12-05-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Adding the sum of cells that are the difference over a specific number

    So basically I have cells with numbers in them. What I want to do is add the amount over a specific amount... let's say 6
    So if A1 had 7 entered and A2 had 9.5 entered the total would be 4.5.
    Hope that makes sense.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,317

    Re: Adding the sum of cells that are the difference over a specific number

    one way

    =SUMPRODUCT((A1:A2-6))

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,850

    Re: Adding the sum of cells that are the difference over a specific number

    Warning to mathophobes: this post contains algebra.

    I would start with some algebra. You should be able to show that sum(ai-k)=sum(ai)-n*k where n is the number of entries. So, something like =sum(A1:A2)-count(A1:A2)*6
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    12-05-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Re: Adding the sum of cells that are the difference over a specific number

    Just tried both solutions and both worked! Thanks so much.
    I was actually on the right path on my own based on the first reply. Thanks JT!
    Mrshorty now has me rethinking some of my more complex formulas. Thanks Mr Shorty!

  5. #5
    Registered User
    Join Date
    12-05-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Re: Adding the sum of cells that are the difference over a specific number

    One Problem I found with both formulas however. If the number is below 6 it will subtract the difference. I only want to add the amount over 6.
    So if A1 had a 9 and A2 had a 5 the total would be 3.

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,850

    Re: Adding the sum of cells that are the difference over a specific number

    From mine, it seems like it should be as simple as replacing the sum() and count() functions with appropriate sumif() and countif() or sumifs() and countifs().

    =sumif(a1:a2,">6")-countif(a1:a2,">6")*6

  7. #7
    Registered User
    Join Date
    12-05-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Re: Adding the sum of cells that are the difference over a specific number

    Thanks again Mr S.
    It works though I'm not really understanding why haha. The *6 is really throwing me off.
    If I remove the *6 I get a different answer obviously but I understand where it's coming from. Adding the *6 makes it the way I want but I don't understand why.
    If you don't want to explain it I understand! Thanks again!

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,317

    Re: Adding the sum of cells that are the difference over a specific number

    Fyi

    =sumproduct((a1:a3>6)*(a1:a3-6))

  9. #9
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,850

    Re: Adding the sum of cells that are the difference over a specific number

    Did you attempt the algebra problem I described in post 3? Expanding the algebra:

    y=(a1-6)+(a2-6)
    y=a1+a2-6-6
    y=(a1+a2)-2*6

    Does that help?

  10. #10
    Registered User
    Join Date
    12-05-2014
    Location
    US
    MS-Off Ver
    2010
    Posts
    5

    Re: Adding the sum of cells that are the difference over a specific number

    Thanks JT Appreciated.
    And Yes MrShorty that does help. Thanks for taking the time to dumb it down for me.

+ 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. [SOLVED] Adding specific text to cells based on another cells data criteria
    By JohnnyBoyxxx in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-26-2015, 02:08 PM
  2. Replies: 3
    Last Post: 05-20-2015, 03:04 PM
  3. [SOLVED] Macros - adding number to specific names
    By eXtr3m3 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-22-2014, 02:37 AM
  4. Adding 1 of 2 numbers to a cell to get a specific number
    By pleasesmile in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-30-2013, 09:05 PM
  5. Formula for adding a date to a specific number
    By Riggs18 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-16-2013, 03:54 PM
  6. Adding numbers from specific cells in a number of sheets
    By c991257 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-03-2006, 05:43 PM
  7. Replies: 4
    Last Post: 07-26-2005, 10:05 PM

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