2022-08-27

Use REGEXEXTRACT() to extract only upper case letters from a sentence in Google sheets

I'm thinking this should be basic but having tried a number of things I'm nowhere nearer a solution:

I have a list of names and want to extract the initials of the names in the next column:

Name (have) Initials (want)
John Wayne JW
Cindy Crawford CC
Björn Borg BB
Alexandria Ocasio-Cortez AOC
Björk B
Mesut Özil

Note that some of these have non-English letters and they may also include hyphens. Using REGEXMATCH() I've been able to extract the first initial but that's where it stops working for me. For example this should work according to regex101:

=REGEXEXTRACT(AH2, "\b[A-Z]+(?:\s+[A-Z]+)*") but only yields the first letter.



No comments:

Post a Comment