+ Reply to Thread
Results 1 to 7 of 7

INDEX MATCH and MIN/SMALL to pull first and second smallest values from array

  1. #1
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    INDEX MATCH and MIN/SMALL to pull first and second smallest values from array

    I'm using this formula to lookup data based on the lowest average.
    Please Login or Register  to view this content.
    The problem is that the minimum average is a two way tie, and I need to return both data sets. It just happens to have the same average.

    I've tried using SMALL(array,1) and SMALL(array,2) in place of MIN above, but it gives me the same data set. I've also tried resizing using offset. See attached.
    Attached Files Attached Files
    If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
    Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: INDEX MATCH and MIN/SMALL to pull first and second smallest values from array

    I am little bit unclear about your approach

    This can be

    =INDEX($I$3:$AF$17,$A3,MATCH(MIN($I$18:$AF$18),$I$18:$AF$18,0))

    simplified as

    =INDEX($I3:$AF3,,MATCH(MIN($I$18:$AF$18),$I$18:$AF$18,0))

    But still I am unable to understand this part

    MATCH(MIN($I$18:$AF$18),$I$18:$AF$18,0)


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: INDEX MATCH and MIN/SMALL to pull first and second smallest values from array

    You could probably do this with a helper column to handle the tie-breaks using =A1+(countif($A$1:A4,A1)/100), copied down - use that for the min() ref
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: INDEX MATCH and MIN/SMALL to pull first and second smallest values from array

    My favourite trick to deal with such situation would be:

    I18:
    =IF(ISERROR(AVERAGE(I3:I17)),"",AVERAGE(I3:I17)-COLUMN()/100000)

    (as you see each average is decrised just by a tiny,tiny bit (more as we go further right. decreased and thus out of two columns with the same average, the left one will be reported first, and right will be reported as a second one with small(...,2)

    You really do not need to care about rounding in this case - if it makes a problem (for instance in printing), just format the cell to show 1 decimal digit.

    then in F3 MIN:
    =INDEX($I$3:$AF$17,$A3,MATCH(MIN($I$18:$AF$18),$I$18:$AF$18,0))
    and in G3 SMALL(..,2):
    =INDEX($I$3:$AF$17,$A3,MATCH(SMALL($I$18:$AF$18,2),$I$18:$AF$18,0))

    and copy both down.
    Last edited by Kaper; 01-18-2014 at 03:34 AM.

  5. #5
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010, Excel 2013 Customer Preview
    Posts
    1,112

    Re: INDEX MATCH and MIN/SMALL to pull first and second smallest values from array

    Hi and thanks for the reply! I'm using this part of the formula MATCH(MIN($I$18:$AF$18),$I$18:$AF$18,0) to find which column to pull the data from.

    The reason I'm not just using the MIN formula for each cell is that would give me the lowest value, but I'm after the lowest two values in my rows of averages to tell me which columns I'm interested in. The averages are on row 18. Does that make sense? BTW- I'm rummy tired and so I'm probably not making much sense...sorry!

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: INDEX MATCH and MIN/SMALL to pull first and second smallest values from array

    Hi tlafferty,

    Have you tried my solution?

    OK, as you are tired (an I just got up - it is 8:46 AM here and I just finished my morning coffe) - please have a look on the attachment.

    Edit: I started answering before coffe - you shall add rather than substract this small lineary increasing part. Anyway, the method works!
    Attached Files Attached Files
    Last edited by Kaper; 01-18-2014 at 03:57 AM.

  7. #7
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: INDEX MATCH and MIN/SMALL to pull first and second smallest values from array

    And here is the solution without touching row 18 - just in F3 and G3.
    In F3 array formula (For you I do not have to explain but for some newbies reading - Ctrl+Shift+Enter committed):

    =OFFSET(A3,0,MIN(IF(MIN($I$18:$AF$18)=$I$18:$AF$18,COLUMN($I$18:$AF$18),""))-1)

    and similar, but with SMALL(... ,2) for G3

    By the way - looking on the formatting I suspect that you are using excel 2007+ (well, in the profile you have 2010) if it is the case, then instead of IF(ISERROR one can use IFERROR in row 18.

+ 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] Problem Using LARGE formula with Index/Match to pull values when there are Duplicates
    By BDavis in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-11-2014, 02:23 PM
  2. Using Index-Match to pull non-unique values
    By acsherman in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-22-2013, 04:08 PM
  3. Replies: 6
    Last Post: 04-12-2013, 05:50 AM
  4. Duplicate values returned using Index Match Lookup with Small()
    By jacob@thepenpoint in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-18-2013, 10:48 AM
  5. Replies: 1
    Last Post: 05-17-2011, 07:36 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