Split string and get last element

Also possible, perhaps best on a copy, with Find:

.+/ 

(Replace with blank) and Search using regular expressions ticked.


Edit: this one is simplier:

=REGEXEXTRACT(A1,"[^/]+$")

You could use this formula:

=REGEXEXTRACT(A1,"(?:.*/)(.*)$")

And also possible to use it as ArrayFormula:

=ARRAYFORMULA(REGEXEXTRACT(A1:A3,"(?:.*/)(.*)$"))

Here's some more info:

  • the RegExExtract function
  • Some good examples of syntax
  • my personal list of Regex Tricks

This formula will do the same:

=INDEX(SPLIT(A1,"/"),LEN(A1)-len(SUBSTITUTE(A1,"/","")))

But it takes A1 three times, which is not prefferable.


You could do this too

=index(SPLIT(A1, "/"), COLUMNS(SPLIT(A1, "/"))-1)