Formula to return five first words in a string

Hi,

Could you please help me to extract the 5 first words from a string?

I have the first one but I don’t know how to for the five first ones:

=If(Pos([field];" ")>0;Left([field];Pos([field];" ")-1);[field])

amadese (BOB member since 2014-12-15)

Just more of the same, I think. Now you’ve found the first word, create a new variable dropping that word from the start. Repeat the process.


mikeil (BOB member since 2015-02-18)

So I created several variables based on the comments from mikeil:

MOT 1 = Substr([Request Description];1;Pos([Request Description];" “)-1)
DESC WITHOUT MOT 1 = Substr([Request Description];Length([MOT 1])+2;Length([Request Description]))
MOT 2 = Substr([DESC WITHOUT MOT 1];1;Pos([DESC WITHOUT MOT 1] ;” “)-1)
DESC WITHOUT MOT 2 = Substr([Request Description];Length([MOT 1])+ Length([MOT 2])+3;Length([Request Description]))
MOT 3 = Substr([DESC WITHOUT MOT 2];1;Pos([DESC WITHOUT MOT 2] ;” “)-1)
DESC WITHOUT MOT 3 = Substr([Request Description];Length([MOT 1]) + Length([MOT 2])+ Length([MOT 3])+4;Length([Request Description]))
MOT 4 = Substr([DESC WITHOUT MOT 3];1;Pos([DESC WITHOUT MOT 3] ;” “)-1)
DESC WITHOUT MOT 4 = Substr([Request Description];Length([MOT 1]) + Length([MOT 2])+ Length([MOT 3]) + Length([MOT 4])+5;Length([Request Description]))
MOT 5 = Substr([DESC WITHOUT MOT 4];1;Pos([DESC WITHOUT MOT 4] ;” ")-1)


amadese (BOB member since 2014-12-15)

There is another method.

If you can set the maximum length of any word to say 15, then set a variable S equal 70.

Replace every occurrence of a space in the original text by S spaces (you can use the fill function for that).

Now extract characters 1 to 15, and trim it.
Extract characters 72 to 100 for the second word, and trim it.
Extract characters 143 to 185 for the third word, and trim it.
Extract characters 214 to 270 for the fourth word, and trim it.
Extract characters 285 to 355 for the fifth word, and trim it.


mikeil (BOB member since 2015-02-18)