Insert a hyphen in a string

Solved
binou -  
 Hugues -
Hello,

I have a table with a list of license plates (the new ones)
I would like to insert a dash between the letters and the numbers:
to have AA-978-BZ instead of AA978BZ

Thank you for your help

1 answer

  1. Vaucluse Posted messages 27336 Registration date   Status Contributor Last intervention   6 453
     
    Hello
    if code in A1:
    in B1:
    =LEFT(A1,2)"-"&LEFT(RIGHT(A1,LEN(A1)-2),LEN(A1)-4)"-"&RIGHT(A1,2)
    for a possible variant of 3 to 4 digits in the numeric zone
    simpler if we assume that the numeric part remains three:
    =LEFT(A1,2)"-"&LEFT(RIGHT(A1,LEN(A1)-2),3)"-"&RIGHT(A1,2)

    best regards
    --
    Let’s ask ourselves if we are not alone in understanding what is being explained?
    12
    1. binou
       
      THANK YOU, it works! It's great!

      Have a nice day.
      0
    2. Hugues
       
      A big thank you for formatting the vehicle registrations (AA-000-AA) in the insurance sector,
      Hugues
      0