+ Reply to Thread
Results 1 to 19 of 19

[CODE] or [FORMALA] To get unique ID's based on latest closed date

  1. #1
    Registered User
    Join Date
    02-19-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    74

    Exclamation [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Hi Experts,

    In my excel spreadsheet, I have two columns "ID" and "Closed Date". I want only unique ID's to show based on latest Closed Date. So would like to know if there is any formula or VBA code that does this.

    Am attaching sample data that contains 10 records, but in real time I have more than 50,000 records. Hence looking for formula or VBA code.

    I appreciate any help provided.

    Thanks,
    Richa
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Try

    =MAX(IF(A2=A$2:A$11,B$2:B$11))
    Array formula, use Ctrl-Shift-Enter
    and copy down
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    You say you want to want to show IDs based on latest closed date... meaning only show 1 ID? which is the latest one? or ignore time, and show all that match the latest date? I assume this would go in another column?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Nevermind... just understood

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Format column C as general
    Format column D as date and time

    in C2
    =IFERROR(INDEX($A$2:$A$11, MATCH(0, COUNTIF($C$1:C1, $A$2:$A$11), 0)),"")
    Array formula, use Ctrl-Shift-Enter
    and copy down

    in D2
    =IF(C2<>"",MAX(IF(A2=A$2:A$11,B$2:B$11)),"")
    Array formula, use Ctrl-Shift-Enter
    and copy down

  6. #6
    Registered User
    Join Date
    02-19-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    74

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Update:
    Meanwhile was searching for similar questions on internet and found a link here that takes me closer to solution but not really close enough.

    This is what I tried:
    Created another column and entered below formula:
    Please Login or Register  to view this content.
    But the result am getting is only for last record as that's the latest closed date overall but am still not getting how to modify the formula that works for my requirement.
    Am getting result as shown in below image:
    UniqueonDate.jpg
    But am trying to get as per below image:
    UniqueonDate1.jpg

    Thanks,
    Richa

  7. #7
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    =IF(MAX(IF(A11=$A$2:$A$11, $B$2:$B$11))=B11, "Newest", "")
    Array formula, use Ctrl-Shift-Enter

  8. #8
    Registered User
    Join Date
    02-19-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    74

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Quote Originally Posted by Special-K View Post
    Format column C as general
    Format column D as date and time

    in C2
    =IFERROR(INDEX($A$2:$A$11, MATCH(0, COUNTIF($C$1:C1, $A$2:$A$11), 0)),"")
    Array formula, use Ctrl-Shift-Enter
    and copy down

    in D2
    =IF(C2<>"",MAX(IF(A2=A$2:A$11,B$2:B$11)),"")
    Array formula, use Ctrl-Shift-Enter
    and copy down
    Thanks and that was quick. Can you please let me know if I can get values in corresponding cells instead of showing results as stack on top rows?

  9. #9
    Registered User
    Join Date
    02-19-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    74

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Quote Originally Posted by Special-K View Post
    =IF(MAX(IF(A11=$A$2:$A$11, $B$2:$B$11))=B11, "Newest", "")
    Array formula, use Ctrl-Shift-Enter
    Thanks. I tried above formula and getting null values.

  10. #10
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    in C2
    =IF(MAX(IF(A2=A$2:A$11,B$2:B$11))=B2,"Newest","")
    Array formula, use Ctrl-Shift-Enter
    and copy down the column

  11. #11
    Registered User
    Join Date
    02-19-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    74

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Is it possible to get results like this as shown in below image?
    UniqueonDate1.jpg

  12. #12
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    I tried pasting (Special K's) this in the formula bar and pressing ctrl-shift-enter to apply it (while in C2), then copied down, and it works as you asked:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The only change I made was chaning the A11=... to A2=... and =B11 to =B2 (in case you were using his exact formula in row 2)

  13. #13
    Registered User
    Join Date
    02-19-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    74

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Quote Originally Posted by Special-K View Post
    in C2
    =IF(MAX(IF(A2=A$2:A$11,B$2:B$11))=B2,"Newest","")
    Array formula, use Ctrl-Shift-Enter
    and copy down the column
    Wow you are awesome and Thanks for all the help. This formula worked.

    Can I use Record Macro to have this in vba code, instead of doing it manually?

    Again, Thank you so much. I really appreciate your help and time.

    Thanks,
    Richa

  14. #14
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,065

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Am no VBA expert.
    You can try it but VBA produced by Macro Recording is usually inefficient.
    Last edited by Special-K; 06-27-2017 at 12:15 PM.

  15. #15
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Try something like this if you want to apply it via VBA:

    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    02-19-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    74

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Quote Originally Posted by Arkadi View Post
    I tried pasting (Special K's) this in the formula bar and pressing ctrl-shift-enter to apply it (while in C2), then copied down, and it works as you asked:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The only change I made was chaning the A11=... to A2=... and =B11 to =B2 (in case you were using his exact formula in row 2)
    Thanks Arkadi. My bad, I just copied down the formula instead of using ctrl+shift+enter keys

    Thanks,
    Richa

  17. #17
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Glad that worked out

    My previous post (last one on page 1) should help you apply the array formula to the range using VBA

  18. #18
    Registered User
    Join Date
    02-19-2016
    Location
    US
    MS-Off Ver
    2007
    Posts
    74

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Quote Originally Posted by Arkadi View Post
    Try something like this if you want to apply it via VBA:

    Please Login or Register  to view this content.
    Perfect and Thank you so much. I really appreciate all the help and time for helping me with this. I would still be struggling on how to start. Thanks for prompt response.

    Thanks,
    Richa

  19. #19
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: [CODE] or [FORMALA] To get unique ID's based on latest closed date

    Glad we could help you sort it out

    Thanks for the feedback and for marking the thread as solved.

+ 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. Replies: 3
    Last Post: 02-10-2016, 07:26 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. Latest date of unique ID's
    By undergrads in forum Excel General
    Replies: 3
    Last Post: 08-05-2014, 12:45 AM
  4. [SOLVED] Returning Earliest and Latest Date for a Unique ID
    By chicity26 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2014, 09:39 AM
  5. 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
  6. Formala to find the best/latest signal
    By Eskimo in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-16-2006, 04:55 PM
  7. code not unique find latest date
    By Barbara Wiseman in forum Excel General
    Replies: 3
    Last Post: 12-11-2005, 04:55 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