Search code examples
excelgoogle-sheetslibreofficeopenoffice-calcformulas

How to extract parsed data from once cell to another


Given a spreadsheet cell containing a string that consists of a hyphenated series of character segments, I need to extract the last segment.

For example, consider column A containing data strings like XX-XXX-X-XX-XX-G10, 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-XX-XX-G10      G10

I'm looking for a formula that could work in in Libre Office Calc, Open Office Calc, MS Excel, or Google Sheets.


Solution

  • Another possibility in LO Calc is to use the general purpose regular expression macro shown here: https://superuser.com/a/1072196/541756. Then the cell formula would be similar to JPV's answer:

    =REFIND(A1,"([^-]+$)")