Search code examples
google-sheetsgoogle-sheets-formula

How to get numeric code from Name and Date?


i want to generate a numeric code from a data consist of name date and a number

A4 has Name = Joel Bansode > this can have multiple combination see the link B4 has a valid Date C4 has a numeric value

the result from this data should have this no. >> 0010503241002 p.s. 001 came from C4, 050324 from may 03 2024 B4, 10 from J in Joel 02 from B in last name Bansode - final 0010503241002

i am using the formula here =TEXT(C4, "000") & TEXT(MONTH(DATEVALUE(B4)), "00") & TEXT(DAY(DATEVALUE(B4)), "00") & RIGHT(YEAR(DATEVALUE(B4)), 2) & TEXT(CODE(UPPER(SUBSTITUTE(LEFT(A4, FIND(" ", A4)-1), " ", ""))) - 64, "00") & TEXT(CODE(UPPER(SUBSTITUTE(MID(A4, FIND(" ", A4)+1, LEN(A4)), " ", ""))) - 64, "00")

but when i change A4 name like add spaces multiple times or add a middle name i dont get proper results see A5 and A6

google sheet link here


Solution

  • You may try:

    =text(C4,"000")&text(B4,"mmddyy")&
     join(,index(text(code(regexextract(A4,"^([A-Z]).*([A-Z])[^ ]*$"))-64,"00")))
    

    enter image description here