Edward
Edward

Reputation: 11

Excel formula for retrieving last portion of a url

I am trying to write a excel forumla that takes the following:

http://www.saga.co.uk/money/taxandbenefits/carersallowance.asp
http://www.saga.co.uk/money/taxandbenefits/index.asp

and from these 2 examples would output:

carersallowance
index

Anyone know how this could be done ? Help would be most appreciated.

Upvotes: 1

Views: 7478

Answers (2)

brettdj
brettdj

Reputation: 55682

If you example was in A1 try

=SUBSTITUTE(REPLACE(A1,1,LOOKUP(2^15,FIND("/",A1,ROW(INDIRECT("1:"&LEN(A1))))),""),".asp","")

Upvotes: 5

Alex K.
Alex K.

Reputation: 175826

Another way;

=RIGHT(A1,LEN(A1)-FIND("::",SUBSTITUTE(A1,"/","::",LEN(A1)-LEN(SUBSTITUTE(A1,"/","")))))

Upvotes: 5

Related Questions