+ Reply to Thread
Results 1 to 6 of 6

Get minimum sum

  1. #1
    Registered User
    Join Date
    11-05-2010
    Location
    Over, There
    MS-Off Ver
    Excel 2016
    Posts
    44

    Get minimum sum

    I am trying to create a formula that would return the smallest sum value for each color.

    For example, in the table below amount 01 and amount 02 are added together. The results I am looking for would be Green 6, Blue 8, and Red 11.

    Color Amount 01 Amount 02
    Green 1 5
    Blue 6 2
    Red 5 6
    Green 8 2
    Red 7 7

    I am trying to avoid having a total column in each row or using macros. Is there a way to do this with just formulas?

  2. #2
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Get minimum sum

    assuming XL2003 (per profile), one option might be:

    =INDEX($A:$A,ROUND(MOD(MIN(INDEX(SUBTOTAL(9,OFFSET($B$2:$C$2,ROW($B$2:$B$6)-ROW($B$2),0))+ROW($B$2:$B$6)/10^7,0)),1)*10^7,0))
    where A2:C6 hold your values

    the above would return "Green", if you were to change Green 1 to 10 then it would return "Blue" (8).

    edit: I realise, belatedly, you're looking to return the unique colour list with lowest total - will revert, if others do not do so first.
    Last edited by XLent; 11-30-2020 at 11:54 AM.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Get minimum sum

    so, apologies -- 2nd attempt -- again, this assumes XL2003 constraints

    F2: =LOOKUP(REPT("Z",255),CHOOSE({1,2},"",INDEX($A$2:$A$6,MATCH(1,INDEX(($A$2:$A$6<>"")*ISNA(MATCH($A$2:$A$6,F$1:F1,0)),0),0))))
    copied down

    G2: =IF($F2="","",MIN(INDEX(SUBTOTAL(9,OFFSET($B$2:$C$2,ROW($B$2:$B$6)-ROW($B$2),0))+9.99E+307*($A$2:$A$6<>$F2),0)))
    copied down

  4. #4
    Registered User
    Join Date
    11-05-2010
    Location
    Over, There
    MS-Off Ver
    Excel 2016
    Posts
    44

    Re: Get minimum sum

    I may have explained what I was looking for wrong, I want to show all of the colors min values (not the name itself) like in the table below.

    Red 11
    Green 6
    Blue 8

    I think I can use that to get me started though, thank you.


    I am using XL2016 (haven't updated my profile in a while).

  5. #5
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Get minimum sum

    so, the formulae in post #3 should work but, using XL2016, you can swap out some of the older approaches c/o later functions, e.g.

    F2: =IFERROR(INDEX($A:$A,AGGREGATE(15,6,ROW($A$2:$A$6)/ISNA(MATCH($A$2:$A$6,$F$1:$F1,0)),1)),"")
    copied down

    G2: =IF($F2="","",AGGREGATE(15,6,SUBTOTAL(9,OFFSET($B$2:$C$2,ROW($B$2:$B$6)-ROW($B$2),0))/($A$2:$A$6=$F2),1))
    copied down

  6. #6
    Registered User
    Join Date
    11-05-2010
    Location
    Over, There
    MS-Off Ver
    Excel 2016
    Posts
    44

    Re: Get minimum sum

    That works perfectly, thank you!

+ 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. Replies: 7
    Last Post: 04-17-2013, 03:53 PM
  2. Find minimum SUM if no minimum number in row
    By zbor in forum Excel General
    Replies: 9
    Last Post: 12-25-2009, 05:04 AM
  3. Which row has the minimum
    By schmidtr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-23-2008, 02:32 PM
  4. Minimum and Zero
    By katzeye in forum Excel General
    Replies: 3
    Last Post: 03-13-2008, 08:54 PM
  5. Minimum Value
    By yuli.tan in forum Excel General
    Replies: 2
    Last Post: 10-16-2007, 07:13 PM
  6. [SOLVED] How to lookup the minimum, 2nd minimum and 3rd minimum.........
    By Mark McDonough in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-15-2006, 04:45 PM
  7. Minimum but One??
    By twogoodtwo in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-29-2005, 10:55 AM
  8. second minimum value
    By Ken in forum Excel General
    Replies: 3
    Last Post: 03-16-2005, 03:06 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