English 中文(简体)
Extract last two words in a cell using openoffice
原标题:

I need a formula to extract the last two words in a cell using openoffice. For example a cell contains the words: "enjoy the rest of your day" I would like to extract "your day" using a formula. I know how to extract the last word:

=RIGHT(A1;LEN(A1)-FIND("*";SUBSTITUTE(A1;" ";"*";LEN(A1)-LEN(SUBSTITUTE(A1;" ";"")))))

which results in "day". But i need a formula for the last two words.

最佳回答

SEARCH supports regular expressions, so use

=RIGHT(A1, LEN(A1) - SEARCH("[^ ]+ +[^ ]+$", A1) + 1)

When I use semicolons as below, Calc silently substitutes commas, but the OP reports success entering it this way:

=RIGHT(A1; LEN(A1) - SEARCH("[^ ]+ +[^ ]+$"; A1) + 1)
问题回答

暂无回答




相关问题
Extract last two words in a cell using openoffice

I need a formula to extract the last two words in a cell using openoffice. For example a cell contains the words: "enjoy the rest of your day" I would like to extract "your day" using a formula. I ...

Generate ODT/DOC(X) and convert to PDF, without OO.o/MS

I have a WSGI application that generates invoices and stores them as PDF. So far I have solved similar problems with FPDF (or equivalents), generating the PDF from scratch like a GUI. Sadly this ...

Effective Version Control for Slides

I have to maintain a huge set of training material in forms of slides. At a first glance, I ve noticed there s no support for version control in OpenOffice OOImpress (but I might be wrong on this). ...

PDF conversion service

I need to develop a service able to convert MS Office and Open Office documents to PDF. And the PDF`s also need to be commentable when opened in ADOBE Reader. I have used a piece of software from www....

热门标签