Split string and get last element

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.

Leave a Comment