Invoke a Formula if Specific Text in a cell

Discuss the spreadsheet application
Post Reply
octxe01
Posts: 1
Joined: Sun Jun 07, 2015 7:03 pm

Invoke a Formula if Specific Text in a cell

Post by octxe01 »

Spreadsheet novice
I have a book with a separate account sheet for each member of a flying group.
An example of one of the regular entries for each member is:-
Flying – Hobbs:0.4 £16.00. Hobbs is the time meter, the rate is £40.00 per hour.
I would like to:-
1) Check the text cell for Hobbs
2) If it is there, take the x.y figures immediately after the :, multiply them by 40 and automatically enter the result in the next column.
3) Be able to alter the 40 for all sheets in the book if someone changes the rate.

I have looked at the tutorials but have not yet been able to find what I am looking for. If someone can point me to the location of the solution, I will gladly follow it. If not, can someone show me how to do what I'm sure is a simple operation.
Thank you.
Open Office 4.1.1 on Windows 7
User avatar
Lupp
Volunteer
Posts: 3549
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Invoke a Formula if Specific Text in a cell

Post by Lupp »

The formula will always be present. Otherwise you would need to resort to user programming.

Well, parsing a text containing compound information by formulae is not exactly an exercice for a spreadsheet novice. In fact it is a bit nasty. Most experienced users would prefer a solution using helper columns. The attached demo is containing one in the single-formula style.

I would a spreadsheet of the kind expect to contain a dedicated column for flight endurances: plain numeric content. No "Hobbs:" needed. To concatenate compound information from elementary data if needed is much easier than the reverse process.

To get the real information out of a compound column once and for all you often can use the tool 'Data' > 'Text to Columns...'. See demo.

(Had a bad hour seemingly. Solution contained in the first attachment too complicated. See new attachment "aoo89983ParseCompundForNumber_2.ods".)

(Edit: Bad attachment removed.)
Attachments
aoo89983ParseCompundForNumber_2.ods
(14.22 KiB) Downloaded 66 times
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
Post Reply