View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default How can I get Excel (2003) to return just the first 4 words (of another cell)?

On Fri, 07 Sep 2007 03:37:37 -0700, ship wrote:

Hi

How can I get Excel (2003) to return just the first 4 words of another
cell?
With thanks


Ship
Shiperton Henethe


What do you want to do if there are less than four words in the cell?

This should get you started. Substitute what you want for less than four words
for the string in the formula below.

=IF((LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ","")))<4,
"LESS THAN FOUR WORDS",
LEFT(TRIM(A1),FIND(CHAR(1),SUBSTITUTE(TRIM(A1)," ",CHAR(1),4))-1))


--ron