View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
[email protected] l.voisin@phoenixdesignhouse.co.za is offline
external usenet poster
 
Posts: 1
Default TRIM IF CELL CONTAINS ONE WORD, ABBREVIATE IF IT CONTAINS MULTIPLE WORDS

Hello,

I wish to combine two cells by using cell A1 and trimming or abbreviating cell B1.
What function and/or macro can I use to recognize whether the cell B1 contains one or mutliple words, in which case it would trim to 3 first letters or abbreviate to first letter of each word only, respectively. So far I have managed to do:

=A1 &concatenate(arrayFormula(if(not(isError(regexextr act(split(B1," "),"\w+"))),left(split(B1," "),3)," " & split(B1," "))))

But thid will take the first three letters of each word...

Please help