Forum Discussion

Peter Johansson's avatar
Peter Johansson
Copper Contributor
Aug 07, 2019
Solved

Extracting text between two instances of a character

I have a URL strings in cells in a column. In another sell I'd like to extract a portion of the URL string. This is the string in A2. https://www.domain.com/lpa/offer/1452258783/   The URL's al...
  • SergeiBaklan's avatar
    Aug 07, 2019

    Peter Johansson 

    More universal

    =RIGHT(IF(RIGHT(A2)="/",REPLACE(A2,LEN(A2),1,""),A2),LEN(A2)-SEARCH("@",SUBSTITUTE(A2,"/","@",LEN(A2)-LEN(SUBSTITUTE(A2,"/",""))-(RIGHT(A2)="/")),1)-(RIGHT(A2)="/"))

    and

    =MID(A2,SEARCH("://",A2)+3,SEARCH("/",RIGHT(A2,LEN(A2)-SEARCH("://",A2)-2))-1)

Resources