Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

[Feature Request] =word(cellref,n) function

Quite often I need to quickly extract certain words from a line of text. Text-to-columns is overkill for this because I usually have to delete all the columns that I I'm not interested in.

What I'd like to see is a function called "word" which extracts the nth word from the text in a cell, which can be used like this:

A                             B              C
the cat sat on the mat        =word(A1,2)    =word(A1,6)

The result is:

the cat sat on the mat        cat            mat

This would be soooooooo much easier than hacking about with =mid(A1,1,find(" ",A1)) ...and similar acrobatics. A "word" is space-delimited text by default, and leading/trailing/multiple spaces should be insignificant - that is, when you ask for word 1, you should get the first space-delimited word and no surrounding spaces.

The full function could allow a delimiter to be specified, for example =word(cellref,pos[,delimiter]) in which you could specify one or more delimiters. Invalid word position numbers should simply cause the function to return empty text ("").