+ Reply to Thread
Results 1 to 12 of 12

find the latest row based on ID and date submitted

  1. #1
    Registered User
    Join Date
    02-15-2014
    Location
    atlanta, ga
    MS-Off Ver
    Excel 2007
    Posts
    10

    find the latest row based on ID and date submitted

    So lets say I have about 10000 rows of data or more. The columns have I have Date, Code, ID, billed amt, and Paid amt. I have ID number which can be repeated number of times, and I want to find the row where the ID and code came through for the last instance. Want to delete the older ones. Also there might be some code and id that were never repeated, so i would want to keep those.
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,918

    Re: find the latest row based on ID and date submitted

    If the data is always in date order in column A then you could use a formula like the one below if F2 and copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    It will identify the ones that can go and the ones to keep.

    BSB

  3. #3
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    536

    Re: find the latest row based on ID and date submitted

    My suggestion is a macro. Insert my code into the VBA module and run.
    Please Login or Register  to view this content.
    Regards.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    02-15-2014
    Location
    atlanta, ga
    MS-Off Ver
    Excel 2007
    Posts
    10
    I have over 800000 rows of data. Excel dont do the function for all. Any other suggestion?


    Quote Originally Posted by BadlySpelledBuoy View Post
    If the data is always in date order in column A then you could use a formula like the one below if F2 and copied down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    It will identify the ones that can go and the ones to keep.

    BSB

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,918

    Re: find the latest row based on ID and date submitted

    In your first post you mentioned around 10k lines. 800k lines is a bit of a step up from there.
    Perhaps if you'd mentioned that in the first place I'd have come up with a different solution!

    Have you tried the VBA approach provided?

    BSB

  6. #6
    Registered User
    Join Date
    02-15-2014
    Location
    atlanta, ga
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: find the latest row based on ID and date submitted

    just got the new file. see attached. field names have changed and also the number of columns. can you help modify your macro accordingly. Date = Batch date; code = CPT; and ID = Account
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    02-15-2014
    Location
    atlanta, ga
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: find the latest row based on ID and date submitted

    tried to modify vba code, but not familiar with it on how to

  8. #8
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: find the latest row based on ID and date submitted

    Try this code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  9. #9
    Registered User
    Join Date
    02-15-2014
    Location
    atlanta, ga
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: find the latest row based on ID and date submitted

    out of memory error

  10. #10
    Valued Forum Contributor
    Join Date
    07-14-2017
    Location
    Poland
    MS-Off Ver
    Office 2010
    Posts
    536

    Re: find the latest row based on ID and date submitted

    @yaksh420, test my modyfied code.
    The results are in sheet 2.
    Please Login or Register  to view this content.
    Regards.
    Attached Files Attached Files

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: find the latest row based on ID and date submitted

    Try this modified code
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-15-2014
    Location
    atlanta, ga
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: find the latest row based on ID and date submitted

    getting out of memory error

+ 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] Find the latest price based on the date
    By jackson_hollon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-14-2016, 01:03 PM
  2. VBA- Filter Pivot table based on latest and 2nd latest date in column
    By ziyan89 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-29-2015, 11:18 AM
  3. Replies: 9
    Last Post: 12-21-2014, 06:29 PM
  4. Powerpivot - Returning latest update based on latest date
    By Kehjz in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 0
    Last Post: 08-22-2013, 02:45 PM
  5. Replies: 1
    Last Post: 04-04-2012, 08:21 AM
  6. Find Latest Date
    By Loisw in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-22-2011, 06:09 AM
  7. To find the latest date
    By Christeen in forum Excel General
    Replies: 13
    Last Post: 05-19-2011, 07:49 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