+ Reply to Thread
Results 1 to 6 of 6

Find thee last value in a row with duplicates

Hybrid View

  1. #1
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Find thee last value in a row with duplicates

    Hi,

    I have a sheet with numbers in descending orders with duplicate in one row and their respective value in 22nd row. I want to find the2nd occurrence of that value. (max. occurrence2 is 2)

    Foe example

    5----4-----3-----3-----2-----2-----1
    A----B-----0---- C-----0-----D-----E

    So if i lockup value "3" C should be returned (not 0) and for 2 "D"

    see attached also

    Thanks a lot
    Attached Files Attached Files
    Mark the thread as solved if you are satisfied with the answer.


    In your first post under the thread tools.

    Mahju

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Find thee last value in a row with duplicates

    With your selection in Cell E1 try

    =IF(COUNTIF($C$3:$I$3,$E$1)>1,INDEX($C$4:$I$4,SMALL(INDEX(($C$3:$I$3=$E$1)*(COLUMN($C$3:$I$3)-ROW($C$3)+1),),COUNTIF($C$3:$I$3,"<>"&$E$1)+2)),INDEX($C$4:$I$4,MATCH(E1,$C$3:$I$3,0)))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Find thee last value in a row with duplicates

    Using your posted workbook.
    A1: a value to find in Row_3...3

    This regular formula returns the corresponding Row_4 item for the last match:
    B1: =INDEX(4:4,MAX(INDEX((C3:I3=A1)*COLUMN(C3:I3),0)))
    In that example, the formula returns: c

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Find thee last value in a row with duplicates

    In other words, you want to match the last (right-most) instance of the lookup value?

    Try this...

    Data Range
    A
    B
    C
    D
    E
    F
    G
    1
    5
    4
    3
    3
    2
    2
    1
    2
    A
    B
    0
    C
    0
    D
    E
    3
    -------
    -------
    -------
    -------
    -------
    -------
    -------
    4
    Lookup
    Result
    5
    3
    C


    This formula entered in B5:

    =LOOKUP(2,1/(A1:G1=A5),A2:G2)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Valued Forum Contributor mahju's Avatar
    Join Date
    11-27-2010
    Location
    Pakistan, Faisalabad
    MS-Off Ver
    Excel 2010 plus
    Posts
    730

    Re: Find thee last value in a row with duplicates

    All worked
    Thanks

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Find thee last value in a row with duplicates

    You're welcome. We appreciate the feedback!

+ 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. Macro to find duplicates, concatenate cells, then delete old duplicates
    By givemepuppies in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 03-04-2016, 02:43 AM
  2. [SOLVED] Macro to find duplicates, concatenate Unique Values, then delete old duplicates
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2013, 04:32 PM
  3. Replies: 4
    Last Post: 06-14-2012, 07:49 AM
  4. Replies: 5
    Last Post: 02-28-2012, 02:52 PM
  5. Replies: 1
    Last Post: 07-13-2010, 10:09 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