Given a spreadsheet cell containing a string that consists of a hyphenated series of character segments, I need to extract the fourth segment.
For example, consider column A containing data strings like XX-XXX-X-G10-XX-XXX, where X denotes any character. What formula would I need to place in column B to get G10 as a result?
A B
1 XX-XXX-X-G10-XX-XXX G10
I'm looking for a formula that could work in in Libre Office Calc, Open Office Calc, MS Excel, or Google Sheets.
One way is to use the following general-purpose macro (tested in LibreOffice):
Then set the cell formula to:
This is similar to my answer to your other question: https://stackoverflow.com/a/38085634/5100564. Thanks to @Ralph for suggesting the
Split
method.It was very simple... MID was the right function:
where:
Pros:
Cons: