+ Reply to Thread
Results 1 to 16 of 16

Does a Derivative of SUMIF exist?

  1. #1
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Does a Derivative of SUMIF exist?

    I am trying to make a formula that is essentially a SUMIF, but based on the criteria the formula adds to cells. Probably an example is best.

    For each "5i" in column B, add the value in Column A to the value in column C. Then, divide by the count of "5i" in column B.

    Effectively, the formula would automatically calculated ((195+-2)+(200+8)+(205+4))/3 = 203.3

    [ A ] [ B ] [ C ]
    Yardage Iron -Lft / +Rgt
    195 5i -2.0
    135 9i 11.0
    200 5i 8.0
    120 PW -7.0
    205 5i 4.0
    175 7i -16.0
    Attached Files Attached Files

  2. #2
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Does a Derivative of SUMIF exist?

    Here is a solution suitable for Excel 20o7 and newer:

    Please try in B3 and copy down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    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,902

    Re: Does a Derivative of SUMIF exist?

    Are you still using Excel 2010?
    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.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Does a Derivative of SUMIF exist?

    Here is another solution suitable for Excel 2013 and newer:

    Please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,456

    Re: Does a Derivative of SUMIF exist?

    @Hans: the SUM/COUNTIF version could be shortened to:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Does a Derivative of SUMIF exist?

    Quote Originally Posted by TMS View Post
    the SUM/COUNTIF version could be shortened to ...
    Please Login or Register  to view this content.
    @Trevor, The function has not been shortened. Both functions are exactly the same length and both refer equally often to a function or to a cell or a range. .


    If you really want it shorter, I think you should omit the reference to column B the second time, but that is not easy in Excel 2013.

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Does a Derivative of SUMIF exist?

    Another option:

    =AVERAGE(IF($B$13:$B$18=A3,$A$13:$A$18+$C$13:$C$18,""))
    Rory

  8. #8
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Does a Derivative of SUMIF exist?

    Yes, that one is really shorter Rory. .

    So it is possible after all.

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,456

    Re: Does a Derivative of SUMIF exist?

    @Hans: I was comparing it to the first formula. Agreed, it is not shorter than the second formula.

    94 =IFERROR(SUM((A$13:A$99)*(B$13:B$99=A3)+(C$13:C$99)*(B$13:B$99=A3))/COUNTIF(B$13:B$99,A3),"-")
    81 =IFERROR(SUM(((A$13:A$99)+(C$13:C$99))*(B$13:B$99=A3))/COUNTIF(B$13:B$99,A3),"-")
    81 =IFERROR(AVERAGEIF(B$13:B$99,A3,A$13:A$99)+AVERAGEIF(B$13:B$99,A3,C$13:C$99),"-")

  10. #10
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Re: Does a Derivative of SUMIF exist?

    Thank you! This seems to work!

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,456

    Re: Does a Derivative of SUMIF exist?

    You're welcome. Thanks for the rep.

  12. #12
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Re: Does a Derivative of SUMIF exist?

    I see an issue with the formula in that it doesn't exclude null values yet incorporates the null shot's distance. As you can see the formula in cell C3 incorporates Shot #1, 3, and 5. However, there wasn't a value for Shot 5 and thus the cell (D11) was null. How can null cells be excluded from the formula? If they aren't excluded, this formula overstates the average distance.
    Attached Files Attached Files

  13. #13
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: Does a Derivative of SUMIF exist?

    Try this in C3 and committed with Ctrl+Shfit+Enter.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Does a Derivative of SUMIF exist?

    About your question in Post #12:

    I think that all formulas, except the formula in Post #4, will still work fine.
    In that example (Post #12), D11 (LFT/RIGHT) is empty. Empty or not empty. An average must be taken over 3 values.
    The average of 200-2, 200+8 and 200 is the average of 198, 208 and 200 is 202.
    And except for the formula in Post #4, all formulas return 202.

  15. #15
    Registered User
    Join Date
    01-14-2015
    Location
    Portland, Oregon
    MS-Off Ver
    Excel for MS 365
    Posts
    40

    Re: Does a Derivative of SUMIF exist?

    The formulas do not ignore the blank (null) cells. At least that is what I see. I've created a spreadsheet that shows various formulas at the top and my desired responses below.

    I really appreciate your expertise on this!
    Attached Files Attached Files

  16. #16
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,433

    Re: Does a Derivative of SUMIF exist?

    O the yardages without LFT/RGT should be completely excluded from the calculation.
    I had misunderstood that.

    The easiest solution is to adjust Rory's formula:

    Please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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] Sumif ignoring duplicates if exist during lookup
    By paradise2sr in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-11-2021, 08:44 AM
  2. [SOLVED] SUMIF error when no data exist
    By Chris McGlothen in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-30-2017, 11:06 AM
  3. First Derivative
    By sramalin in forum Excel General
    Replies: 8
    Last Post: 08-24-2015, 06:52 AM
  4. Derivative of SUM Function Maybe?
    By Patish in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-22-2014, 05:29 AM
  5. Derivative of a function
    By krusader23 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 10-01-2013, 02:06 AM
  6. SumIf 2 Variables Exist
    By shelanp in forum Excel General
    Replies: 5
    Last Post: 06-03-2011, 09:54 AM
  7. Second derivative
    By Royshh in forum Excel General
    Replies: 0
    Last Post: 04-27-2005, 06:58 AM

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