+ Reply to Thread
Results 1 to 8 of 8

Last Instance of a record in a list

  1. #1
    Registered User
    Join Date
    04-10-2014
    Location
    Telford, England
    MS-Off Ver
    ms365
    Posts
    34

    Last Instance of a record in a list

    Hi Folks,

    I want the word "Yes" to appear in column C, adjacent to the last record in a list of duplicate entries in a column.

    (see attached).

    e.g. the record 1405800475 (in Column A) should have "Yes" in cell C86.

    Each week I add about 1000 new rows to the bottom of the list, so I need to be able to drag it down to keep the last record updated.

    Hope this is clear.

    Any help would as always, be gratefully appreciated.

    Mike
    Attached Files Attached Files

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

    Re: Last Instance of a record in a list

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    in row 2 and copied down

    Regards, TMS
    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
    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,422

    Re: Last Instance of a record in a list

    And maybe:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    Regads, TMS

  4. #4
    Registered User
    Join Date
    04-10-2014
    Location
    Telford, England
    MS-Off Ver
    ms365
    Posts
    34

    Re: Last Instance of a record in a list

    HI TMS,

    that works perfectly.

    is there an advantage to the second formula?

    MIke

  5. #5
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Last Instance of a record in a list

    I've found from previous threads that using COUNTIF or a similar function with an expandable range causes excel to hang after it's copied down a few thousand rows.

    This should be more stable.

    For first record, try this formula in B2

    =IF(ISNUMBER(MATCH(A2,A1:A$1,0)),"No","Yes")

    For last record,

    Define a named range called 'lastcell'

    In the refers to box, enter the formula, =INDEX(Sheet1!$A:$A,MATCH(1e+100,Sheet!$A:$A))

    Then use this formula in C2

    =IF(ISNUMBER(MATCH(A2,A3:lastcell,0)),"no","yes")

    Then use autofill to copy down.

  6. #6
    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,422

    Re: Last Instance of a record in a list

    You're welcome. Thanks for the rep.

    is there an advantage to the second formula?
    No. It just differentiates between the last of many and the last where the last is the only one. Depends if that's useful or not

  7. #7
    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,422

    Re: Last Instance of a record in a list

    @jason.b75

    ... an expandable range causes excel to hang ...
    Not sure what that means. I've never encountered that issue. You appear to have a similar construct to mine, given that MATCH(A2,A1:A$1,0) will expand; A$1 is static and A1 will increase as the formula is dragged down.

    Your Named Formula has an error:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    should be
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And the last outcome looks as though it may be wrong; at least, we don't agree on the outcome. Cell A1 has 1405817397 and I think that is the first, and only entry, and therefore the last entry for that value.

    Regards, TMS

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Last Instance of a record in a list

    Hi Trevor

    To elaborate on the expanding range issue, I've only noticed it with countif(s), etc. Match and other functions seem to be ok, maybe it's something caused by the range object requirement in the first argument?

    Try copying the records in column A down for 15-20k rows, then compare calculation times.

    For me, the countif method takes about 10 seconds to autofill, the match method takes about 1 second.

    Subsequently, adding extra records in sets of 1k rows (the OP's approximate weekly addition), takes about 4 seconds to process for countif, with a noticeable increase in the strain as the overall volume of data increases.

    For the discrepancy in the results, I forgot to include an adjustment in the named range formula, it should have been

    =INDEX(Sheet1!$A:$A,MATCH(1e+100,Sheet1!$A:$A)+1)

    Otherwise the last row will always be incorrectly matched to itself instead of looking for a subsequent (non-existent) record.

+ 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. Identifying Duplicates after First Instance of Record
    By aaron1976 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-23-2015, 01:10 PM
  2. [SOLVED] Find 2nd, 3rd, 4th instance in list
    By BennyH in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-06-2014, 06:57 PM
  3. [SOLVED] Counting and Summing only one instance of a record
    By smls in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-10-2013, 02:54 PM
  4. Finding Last instance in a list
    By skate1991 in forum Excel General
    Replies: 3
    Last Post: 05-09-2013, 11:51 AM
  5. Returning Only One Instance In A List
    By bopsgtir in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-08-2013, 12:03 PM
  6. Lookup Second to Last instance in a list
    By dcgrove in forum Excel General
    Replies: 1
    Last Post: 08-26-2010, 03:51 AM
  7. Return only 1 instance in a list
    By jarvo in forum Excel General
    Replies: 4
    Last Post: 03-04-2005, 06:03 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