+ Reply to Thread
Results 1 to 18 of 18

Unique Identifiers That Don't Change?

Hybrid View

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

    Re: Unique Identifiers That Don't Change?

    Try this worksheet event.
    Private Sub Worksheet_Change(ByVal Target As Range)
    Application.EnableEvents = False
    Dim temp As Long, LR As Long
    LR = Range("C" & Rows.Count).End(xlUp).Row + 1
    If Target.Cells.Count = 1 Then
    If Target.Column = 2 And Target.Offset(0, 1).Value = "" Then
    temp = Target.Value
    K = Evaluate("=TEXT(MAX(IF(C3:C" & LR & "<>"""",1*RIGHT(C3:C" & LR & ",5),""""))+1,""00000"")")
    Target.Offset(0, 1).Value = "CB-" & Year(temp) & "-" & K
    End If
    End If
    Application.EnableEvents = True
    End Sub
    Worksheetevent

    How to use the code
    Right click on Sheet tab --> view code
    Visual Basic (VB) window opens.
    Paste the code
    Close the VB window.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 07-15-2021 at 07:43 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  2. #2
    Registered User
    Join Date
    09-15-2020
    Location
    Vancouver, Canada
    MS-Off Ver
    Office 365
    Posts
    5

    Re: Unique Identifiers That Don't Change?

    Quote Originally Posted by AliGW View Post
    I think this may well scupper the solutions already offered. It may be that you have to go down the VBA route for this.
    I feared as much...

    Quote Originally Posted by kvsrinivasamurthy View Post
    Try this worksheet event.
    Unfortunately this can result in identical values. For example, if the value CB-2021-0005 already exists, and a user inserts a new row between the 4th and 5th row of the table with the year 2021, that value will also show CB-2021-0005. Thank you for your effort!

+ 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] Need unique identifiers based on list?
    By Katie620 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-17-2017, 02:33 PM
  2. using unique identifiers while performing function
    By txdude311 in forum Excel General
    Replies: 1
    Last Post: 07-26-2016, 06:17 PM
  3. Identify inconsistent unique identifiers
    By Brawnystaff in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-04-2016, 12:27 AM
  4. Replies: 7
    Last Post: 06-27-2014, 02:26 AM
  5. Sorting based on unique identifiers
    By excel_beginner2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2014, 10:09 AM
  6. How to merge different spreadsheets with no unique identifiers
    By newbieexcelgirl in forum Excel General
    Replies: 2
    Last Post: 01-17-2013, 11:42 AM
  7. Excel 2007 : adding values with unique identifiers
    By AntiC in forum Excel General
    Replies: 3
    Last Post: 01-27-2012, 10:52 AM

Tags for this Thread

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