+ Reply to Thread
Results 1 to 4 of 4

Modifying an INDEX and MATCH formula to advance if duplicate found

Hybrid View

  1. #1
    Registered User
    Join Date
    04-29-2020
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    2

    Modifying an INDEX and MATCH formula to advance if duplicate found

    Hello,

    I have a table of years with a corresponding dollar amount. I have written a function that will return the column header (offer) when given a dollar amount.

    =INDEX($H$1:$N$1,MATCH(C8,$H$3:$N$3,0))

    .. which is working just fine. However, it will only ever return the first lowest offer, and not the next offer with the same value. In my example, the lowest offer for item B is $18, found in offer 1. The 2nd lowest offer is also $18, found in offer 4.

    Is there a way to rewrite this formula to give me the next, or nth next offer of the same amount?

    My thought was to try an IF formula, so that if D3 = C3, it would advance the bound on the index by a certain amount, but could not figure out how to replace the letter in a column reference. Is this possible to do?

    Sheet attached, and here is what I was thinking

    =IF(INDEX(N$1:AB$1,MATCH(J32,N32:AB32,0))=C37,INDEX(N$1:AB$1,MATCH(J32,N32:AB32,0)),INDEX(N$1:AB$1,MATCH(J32,N32:AB32,0)))

    -IF(INDEX(H1:N1,MATCH(D8,H3:N3,0)) = INDEX(H1:N1,MATCH(C8,H3:N3,0)), INDEX(H1:N1,MATCH(D8,(write something to replace the letter H using COLUMN maybe?)3:N3,0)), INDEX($H$1:$N$1,MATCH(D8,H3:N3,0))

    Appreciate any help or ideas!

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,953

    Re: Modifying an INDEX and MATCH formula to advance if duplicate found

    C2:E3
    =INDEX($H$1:$N$1,MATCH(SMALL(INDEX($H$2:$N$3,ROW($A1),),C$1),INDEX($H$2:$N$3,ROW($A1),),0))
    c8:E9
    =SMALL(INDEX($H$2:$N$3,ROW($A1),),C$1)
    Attached Files Attached Files
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    04-29-2020
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    2

    Re: Modifying an INDEX and MATCH formula to advance if duplicate found

    Thank you for the attempt, but I think I did not explain correctly.

    When I add a duplicate min value to row A or B, your formula only returns the first header for both, not the 2nd duplciate header.


    Looking at my original document, the ideal formula would find return Offer 1 for cell C3, and return Offer 4 for D3.

    Thank you for trying though!

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

    Re: Modifying an INDEX and MATCH formula to advance if duplicate found

    Please try at Office 365 dynamic array at

    C2
    =INDEX(SORT($H$1:$N$3,ROWS(C$1:C2),,1),1,SEQUENCE(1,3))

    C7
    =SMALL(H2:N2,SEQUENCE(1,3))

    or normal formula
    C2:E2
    =INDEX($H$1:$N$1,MOD(SMALL(INT($H2:$N2)*1000+COLUMN($H2:$N2),COLUMNS($C2:C2)),1000)-COLUMN($G2))

    C7:E7
    =SMALL($H2:$N2,COLUMNS($C7:C7))
    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] index/match formula for duplicate values not working
    By Ochimus in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-26-2021, 09:49 AM
  2. [SOLVED] Help with advance if, match and index
    By abhineet.sabharwal in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-03-2015, 08:07 PM
  3. Replies: 2
    Last Post: 07-23-2015, 07:10 AM
  4. [SOLVED] Index/Match between some columns - thanks in advance!
    By Drayde in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-08-2015, 01:44 PM
  5. Down rows until specific value is found within index(/match( formula
    By zakquis in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-15-2014, 02:47 AM
  6. Replies: 3
    Last Post: 04-01-2014, 05:54 PM
  7. Macro to copy paste if match not found "go to next"
    By HawksOkeyoJr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2013, 05:28 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