Results 1 to 3 of 3

Thread: Identifying the last duplicated string

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    9
    Rep Power
    0

    Identifying the last duplicated string

    Excel Gurus,

    I need help, I am trying to find a formula to indicate the last duplicated string in a column by placing a 1 next to it, please see below:


    A B C D
    Date Name Laps Final Laps Recorded Indicator
    5-4 Dan 23
    5-6 Billy 21
    5-3 Mike 26
    5-8 Billy 22 *
    5-3 Dan 28 *
    5-10 Mike 26 *


    Based on this table above, I want to find the last duplicated name in column B, and put a one by it in column D so it should look like this:
    (in my spreadsheet there are empty rows between data because of the way it is imported, so the formula would need to account for that)
    A B C D
    Date Name Laps Final Laps Recorded Indicator
    5-4 Dan 23
    5-6 Billy 21
    5-3 Mike 26
    5-8 Billy 22 1
    5-3 Dan 28 1
    5-10 Mike 26 1


    I cannot seem to figure it out, any help would be appreciated!

  2. #2
    Junior Member xladept's Avatar
    Join Date
    May 2016
    Posts
    12
    Rep Power
    0
    Try this:

    Code:
    Sub Partho(): Dim r As Long, N As String, K
    With CreateObject("scripting.Dictionary")
    For r = 2 To Range("B" & Rows.count).End(xlUp).Row
    If Cells(r, 2) <> "" Then
    N = Trim(Cells(r, 2)): .Item(N) = r: End If: Next r
    K = .Keys(): For r = LBound(K) To UBound(K)
                    Cells(.Item(K(r)), 4) = 1: Next r
    End With: End Sub
    You can't do one thing.

    Orrin

  3. #3
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    659
    Rep Power
    13
    If I understand what you want correctly and assuming Row 1 contains the headers and your data starts on Row 2, put this formula in cell D2 and copy it down to the end of your data...

    =IF(B2="","",IF(COUNTIF(B2:B$16,B2)=1,1,""))

    The red highlighted number needs to be any number equal to or greater than the last row number containing your data (make sure you retain that $ sign that is in front of the number).

Similar Threads

  1. Identifying Zero-to-Non-Zero Value and vice versa
    By nsturk725 in forum Excel Help
    Replies: 4
    Last Post: 12-02-2014, 08:31 PM
  2. Replies: 8
    Last Post: 09-04-2014, 02:45 AM
  3. string manipulation
    By kylefoley76 in forum Excel Help
    Replies: 5
    Last Post: 02-20-2014, 12:10 AM
  4. Replies: 2
    Last Post: 06-08-2013, 09:32 PM
  5. Concatenate array string
    By tushar.tarafdar in forum Excel Help
    Replies: 2
    Last Post: 09-20-2012, 12:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •