+ Reply to Thread
Results 1 to 6 of 6

Maximum SUM in a column with a criterion

  1. #1
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Maximum SUM in a column with a criterion

    This arose today when I was helping someone here. I am confused.... Any explanations on offer????

    This is a standard formula used to return the maximum SUM in a column with one criterion:
    =IFERROR(1/(1/LARGE(INDEX(SUMIFS(C3:C10,A3:A10,"A",B3:B10,B3:B10),0),1)),"")


    and this returns the corresponding value in another column.
    =IFERROR(INDEX(B3:B10,MATCH(F4,INDEX(SUMIFS(C3:C10,A3:A10,"A",B3:B10,B3:B10),0),0)),"")

    Refer to the file. Blocks A, B, C and D are EXACTLY the same data/formulae, with the sole exception that the values for Joe (the bloke with the highest SUM value) vary. The values increase from left to right. One 3/4 occasions Joe's name is returned correctly.

    Block A, it works.. Block B, it works, Block C... it doesn't (!!!), Block D it starts working again. In block E, I found that a 1/(1/SUMIFS) fixed it and Joe's name is, once again, returned.

    I have been travelling for a couple of days and I'm tired and a bit grumpy. I cannot see why this is failing in Block C and it's beginning to annoy me. Does anyone know why Block C has failed?
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Maximum SUM in a column with a criterion

    Using
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in T4 also fixes it, so can only assume it's to do with floating point errors.

  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,908

    Re: Maximum SUM in a column with a criterion

    Some sort of rounding error. This fixes it:

    =IFERROR(ROUND(1/(1/LARGE(INDEX(SUMIFS(Q3:Q10,O3:O10,"A",P3:P10,P3:P10),0),1)),0),"")
    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 Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Maximum SUM in a column with a criterion

    Can you have floating point problems with integers?? No reason why not, I guess since they're double reciprocals.. I put that bit in to avoid null responses in the Post that I was replying to. I shall play with this, as I have my doubts. Back later...

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Maximum SUM in a column with a criterion

    As a simple test, if you use
    =(200000-T4)*10^10
    it returns 0.29
    It appears that match looks at the whole value & not just the 1st 15 significant digits.

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Maximum SUM in a column with a criterion

    I also think this is caused by floating-point as 1/20000 is not an integer

    There are many numbers that cause this eg: 98, 99

    I set this
    =MATCH(1/(1/C14),C14,0) Exact match
    =MATCH(1/(1/C14),C14,1) Less than
    =MATCH(1/(1/C14),C14,-1) Greater than

    98 gives N/A for Exact match and Greater
    99 gives N/A for Exact match and less

    But this only happens with LOOKUP Function.

    =1/(1/C14)=C14 give True on every Integer
    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. Sum values of a row if search criterion is found in a column
    By pvp1900 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-12-2019, 05:32 AM
  2. Replies: 7
    Last Post: 10-07-2015, 03:01 PM
  3. [SOLVED] Adding the values of a column after meeting criterion
    By Mirell in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2015, 12:23 AM
  4. Find value based on item number (first criterion) and date (second criterion)
    By ivan.stajin in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-19-2014, 10:47 AM
  5. [SOLVED] Concatenating values two columns (column B, column C) based on criterion
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2014, 11:31 AM
  6. [SOLVED] Find maximum with a criterion
    By j_Southern in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-30-2013, 11:30 AM
  7. Return a name from dated column 1 criterion
    By ABSTRAKTUS in forum Excel General
    Replies: 3
    Last Post: 04-30-2010, 11:59 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