+ Reply to Thread
Results 1 to 25 of 25

"Flag" row of duplicate entries with the greatest date

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    "Flag" row of duplicate entries with the greatest date

    I have some data that I need to keep whole (meaning I can't use Remove Duplicates and I don't want to do too much sorting), but need a way of "flagging" duplicate values with the greatest date.

    For Example:
    ROW RECORD ASSIGNED
    0000123456 6/17/2015
    3 0000123456 6/24/2015
    4 0000234567 6/17/2015
    5 0000345678 6/24/2015


    In column A, I want to "flag" each unique value, but where it finds duplicates in column B, only flag the one with the greatest date. By "flag", I mean return the Row each unique (and greatest unique) value resides. Therefore in the above, cell A2 would be blank because it is a duplicate value to row 3 with a lesser date.

    I can then use the Row number as a unique value to lookup the data for reporting. Does this make sense?

  2. #2
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: "Flag" row of duplicate entries with the greatest date

    Does this do what you are looking for?
    Please Login or Register  to view this content.
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  3. #3
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    Nigel,
    Thanks for the reply. No, it doesn't work. It gives some row values, but not for all unique rows (or greatest date within duplicate rows).

  4. #4
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: "Flag" row of duplicate entries with the greatest date

    Can you upload a spreadsheet showing where the formula doesn't work and what the expected outcome should be?

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: "Flag" row of duplicate entries with the greatest date

    With data in colums A and B, in C2, use this ARRAY formula copied down

    =IF(COUNTIF($A$2:$A$5,A2)>1, IF(MAX(($B$2:$B$5)*($A$2:$A$5=A2))=B2,"X",""),"X")
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.


    See attached.
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    Ok, Nigel, Sorry! It did work...I just screwed up part of the formula. Thanks!

  7. #7
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: "Flag" row of duplicate entries with the greatest date

    Oh good. I couldn't figure out what would have been wrong.

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: "Flag" row of duplicate entries with the greatest date

    Removed by author.
    Last edited by newdoverman; 07-01-2015 at 10:15 AM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  9. #9
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    CHemistB,
    Your formula totally ignores duplicates, rather than returning the value of one of the duplicates with the greatest date.

  10. #10
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: "Flag" row of duplicate entries with the greatest date

    My formula puts an X next to all unique values and next to the duplicate with the highest date.

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: "Flag" row of duplicate entries with the greatest date

    Removed by author.
    Last edited by newdoverman; 07-01-2015 at 10:14 AM.

  12. #12
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    Nigel,
    I was wrong...it's not working.
    Attached is a duplicate entry. It's supposed to be looking at duplicate values in column E (Unique ID) then returning the row of the largest date.

    the formula returns a value for the 3/31/2014 entry rather than the 6/17/2015 entry.

    ideas?
    Attached Files Attached Files

  13. #13
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: "Flag" row of duplicate entries with the greatest date

    You switched the sign for N2. It needs to be greater than instead of less than. This one works:
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    i had changed that because it seemed to be grabbing the lesser of dates, but i just tried copying your exact formula. it works for one set of duplicates, but not a second. look at McCormick and Hanley in this workbook. for McCormick, it grabs the 6/23/2014 date instead of the 6/22/2015 date, but for Hanley it grabs the correct date.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    Chemist,
    Here's your formula in my spreadsheet. It skips over the duplicates in every circumstance.
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: "Flag" row of duplicate entries with the greatest date

    For some reason your dates in column N are not actual dates, they are being seen as text within the formulas. This fixes that:
    Please Login or Register  to view this content.

  17. #17
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: "Flag" row of duplicate entries with the greatest date

    Your dates are entered as text so the formula doesn't work. Here, I converted them to numbers.

    Alternately, you can modify the formula to

    =IF(COUNTIF($E$10:$E$1509,E10)>1, IF(MAX(($N$10:$N$1509)*($E$10:$E$1509=E10))=N10+0,"X",""),"X")
    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.
    Attached Files Attached Files
    Last edited by ChemistB; 06-30-2015 at 05:06 PM.

  18. #18
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: "Flag" row of duplicate entries with the greatest date

    Removed by author.
    Last edited by newdoverman; 07-01-2015 at 10:13 AM.

  19. #19
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: "Flag" row of duplicate entries with the greatest date

    Removed by author.
    Last edited by newdoverman; 07-01-2015 at 10:13 AM.

  20. #20
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    Nigel,
    Again, thank you for your time on this. UNfortunately, once I expand the ranges beyond the current data set, your formula bombs. IN the spreadsheet I sent you, expand the range to 10:16 and you get #VALUE error. I've got my spread sheet set to 1500 rows of information because this will be used week to week with varying amounts of data.

  21. #21
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    Chemist,
    Thank you for your time! The second formula worked perfectly. I definitely appreciate your time!

    Matt

  22. #22
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: "Flag" row of duplicate entries with the greatest date

    Removed by author.
    Last edited by newdoverman; 07-01-2015 at 10:12 AM.

  23. #23
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: "Flag" row of duplicate entries with the greatest date

    You are correct. If DATEVALUE finds an empty cell, it will return an error. Chemist's method of adding 0 doesn't have that problem. So this formula would now work with all 1500+ rows even if there are empty cells in the range.

    Please Login or Register  to view this content.

  24. #24
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: "Flag" row of duplicate entries with the greatest date

    For helpful learning material, I found this that shows easy ways to convert dates stored as text to numerical values that Excel can use to do calculations.

    http://excelsemipro.com/2010/08/the-...ng-text-dates/

  25. #25
    Registered User
    Join Date
    01-28-2014
    Location
    Schenectady, NY
    MS-Off Ver
    Office 365
    Posts
    65

    Re: "Flag" row of duplicate entries with the greatest date

    thanks for all your help!

+ 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. Date format of just "st" "nd" "rd" and "th" with text included
    By notrandom in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-10-2013, 05:45 PM
  2. Return "green", "yellow" or "red" from date/age and priority ranking
    By Cantaloop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-04-2013, 12:12 AM
  3. Find id"" and replace with id"consecutive number" 3071 entries
    By RoyLittle0 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-19-2012, 07:27 AM
  4. Replies: 1
    Last Post: 09-15-2010, 01:55 AM
  5. Unable to get date to flag "late" in macro
    By rgleeso1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-29-2009, 06:06 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