Find Last Occurence In String

Posted in Calculations by Dempsey
.

The function Position(text, search string, start, occurrence) scans the supplied text for the nth occurrence of a search string, starting where you indicate with start.

Here’s the neat bit: a negative occurrence value causes the scan to go in the opposite direction. The following gives the position of the LAST occurrance of string in text:

position(text, string, length(text), -1)

Leave a Reply