• notice
  • Congratulations on the launch of the Sought Tech site

Single letter plus period, that is, the first letter of the middle name (if it is a single letter plus a period, if it is not normal, add a period)

I have a strange situation that I am trying to resolve.

Single letter plus period, that is, the first letter of the middle name (if it is a single letter plus a period, if it is not normal, add a period)

I have a list of names in a different format.All I want to do is add a period to a single letter since it's a middle initial.

I tried:

=IF(LEN(A2)=1,A2&".",IF(A2="","",A2&" "))

This works, but will miss entities with "&" and another name.So in A2, the result is Michael F.& Jane J instead of Michael F.& Jane J.

=SUBSTITUTE(SUBSTITUTE(TRIM(A2)," &",".&")&".","..",".")

In a cell with a single name and no middle initials or cells without a name or a filled middle name case, this will encounter an error.

Single letter plus period, that is, the first letter of the middle name (if it is a single letter plus a period, if it is not normal, add a period)

Any suggestions? Text to columns also works.I could separate them and run the above formula on all four columns, then join, but that's an inefficient procedure.

Thank you!

uj5u.com enthusiastic netizens replied:

inB2, copy the formula:

=SUBSTITUTE(SUBSTITUTE(A2," &",".&")&".","..",".")

Single letter plus period, that is, the first letter of the middle name (if it is a single letter plus a period, if it is not normal, add a period)

Edit:

If your source has spaces after the last paragraph, try adding a trim() to remove the last space , the formula becomes >>

=SUBSTITUTE(SUBSTITUTE(TRIM(A2)," &",".&")&".","..",".")

uj5u.com enthusiastic netizens replied:

is a bit far-fetched, but with Excel Microsoft365, use LET ():

Single letter plus period, that is, the first letter of the middle name (if it is a single letter plus a period, if it is not normal, add a period)

FormulaB2:

=LET(X,FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A2,"&","&#38;")," ","< ;/s><s>")&"</s></t>","//s"),TEXTJOIN(" ",,IF(LEN(X)=1,IF(X< ;>"&",X&".",X),X)))

Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+