Search code examples
regexif-statementgoogle-sheetslambdaextract

Extract First chracter of all words except the first one


I have list of names and i am tryign to extract the First word then First character of 2nd word and 3rd character of 3rd work and so on...

I was only able to make this formula but it works till 2nd name how to achieve further any help will be much appreciated.

=LEFT(D4,FIND(" ",D4)-1)&" "&LEFT(LEFT(D4,SEARCH(" ",D4)-1),1)

enter image description here

[enter link description here][2]

[2]:

Link


Solution

  • try:

    =ARRAYFORMULA(IFNA(REGEXEXTRACT(B2:B, "\w+ ")&
     BYROW(B2:B, LAMBDA(x, TEXTJOIN(, 1, IFNA(REGEXEXTRACT(
     SPLIT(REGEXREPLACE(x, "^(\w+) ", ), " "), "[A-Z]"))))))
    

    enter image description here


    update:

    =ARRAYFORMULA(IFNA(TRIM(REGEXEXTRACT(B2:B, "\w+")&" "&
     BYROW(B2:B, LAMBDA(x, TEXTJOIN(, 1, IFERROR(REGEXEXTRACT(
     SPLIT(REGEXREPLACE(x&" ", "^(\w+) ", ), " "), "[A-Z]"))))))))
    

    enter image description here