+ Reply to Thread
Results 1 to 10 of 10

Concise way to match last value against any other value in range

  1. #1
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Concise way to match last value against any other value in range

    So I am looking for a concise way to see if the last cell in a row within a specified range matches any previously entered value within that row.

    For example, looking at this data:

    1 23 34 1 match
    2 3 3 match
    3 5 4 6 5 match

    Now it would be looking at a much larger dataset, and I would prefer if I didn't need to test each individually (there can be a lot of tests).

    I can use:

    Please Login or Register  to view this content.
    to return the last non-zero value, but I am stuck on the concise way to test against all previous values. I can only think of volatile ways utilizing indirect, which I want to avoid if at all possible mainly due to the sheer size of my file.
    Last edited by TheN; 10-02-2016 at 11:22 AM. Reason: Realized above formula was wrong...

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Concise way to match last value against any other value in range

    Why can't you just use COUNTIF?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


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

    Re: Concise way to match last value against any other value in range

    Just how big is this sheet?
    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 Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Concise way to match last value against any other value in range

    Data in D2:K4, formula in L2,then drag down
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 10-02-2016 at 03:19 AM.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Concise way to match last value against any other value in range

    Another way.
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    A
    B
    C
    D
    E
    F
    1
    1
    23
    34
    1
    match
    2
    2
    3
    3
    match
    3
    3
    7
    4
    6
    9
    not
    Dave

  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: Concise way to match last value against any other value in range

    Here's another one...

    Data Range
    A
    B
    C
    D
    E
    F
    1
    ------
    ------
    ------
    ------
    ------
    ------
    2
    1
    23
    34
    1
    Match
    3
    2
    3
    3
    Match
    4
    3
    5
    4
    6
    5
    Match


    This formula entered in F2 and copied down:

    =IF(COUNTIF(A2:E2,LOOKUP(1E100,A2:E2))>1,"Match","")
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: Concise way to match last value against any other value in range

    Quote Originally Posted by TMS View Post
    Why can't you just use COUNTIF?
    I posted it when it was quite late, and simply overlooked the obvious. Thanks everyone for your time.

    I especially like Tony Valko's solution, so I am glad I posted anyway, it looks like a very efficient way to do it.

    Once again, thank you everyone.

    My final formula ended up being quite complicated, but the format provided cleaned it up to the point where you can actually see what's going on.

    Please Login or Register  to view this content.
    Last edited by TheN; 10-10-2016 at 08:11 PM.

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

    Re: Concise way to match last value against any other value in range

    You're welcome. Thanks for the feedback!

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Concise way to match last value against any other value in range

    @TheN: yep, that's what I wondered. I'd probably have done something similar to Tony's solution with your original LOOKUP. But away for the weekend and only got iPad with me. Glad you have learnt from it.

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Concise way to match last value against any other value in range

    Thanks for the rep.

+ 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. Cannot figure out concise what to write if-or formula
    By jam320 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-17-2014, 05:06 PM
  2. [SOLVED] Question: Concise List
    By sglick in forum Excel General
    Replies: 3
    Last Post: 05-09-2014, 06:26 AM
  3. making a lookup formula more concise
    By ammartino44 in forum Excel General
    Replies: 3
    Last Post: 02-21-2014, 08:40 PM
  4. Make repetitive IF formula more concise?
    By leaning in forum Excel General
    Replies: 7
    Last Post: 03-18-2011, 05:48 AM
  5. making my data more concise
    By chedges in forum Excel General
    Replies: 2
    Last Post: 02-11-2009, 12:22 PM
  6. a more concise formula
    By jwongsf in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-15-2009, 10:20 AM
  7. Concise border removal method
    By XP in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2006, 04:15 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