Skip to main content
Solved

Alphanumeric ID based on multiple cells

  • July 22, 2024
  • 2 replies
  • 27 views

Forum|alt.badge.img+4

Hi all, I was wondering if you could help me create a formula that would output an alphanumeric ID based on variables in other cells in the row. I'd like to create an ID that include:

  1. First, if Cell A = xYx then add "Z" to start. If Cell A = YxY then add "ZD" to start.
  2. Then, take first letter from name and surname, and then add these. So John Smith becomes JS
  3. Then, add first 4 digits from date field (DOB). So, 14/11/1980 becomes 1411

So, as an example, ZDJS1411.

Thanks so much community!

Best answer by TheTimeSavingCo

Does this look right?

SWITCH( {Cell A}, 'xYx', 'Z', 'YxY', 'ZD' ) & LEFT( {First name}, 1 ) & LEFT( Surname, 1 )& DATETIME_FORMAT( DOB, "DDMM" )

2 replies

TheTimeSavingCo
Forum|alt.badge.img+31

Does this look right?

SWITCH( {Cell A}, 'xYx', 'Z', 'YxY', 'ZD' ) & LEFT( {First name}, 1 ) & LEFT( Surname, 1 )& DATETIME_FORMAT( DOB, "DDMM" )

Forum|alt.badge.img+4
  • Author
  • New Participant
  • July 23, 2024

Does this look right?

SWITCH( {Cell A}, 'xYx', 'Z', 'YxY', 'ZD' ) & LEFT( {First name}, 1 ) & LEFT( Surname, 1 )& DATETIME_FORMAT( DOB, "DDMM" )

Wow... Yes, that absolutely does! Thanks so much Adam.