+ Reply to Thread
Results 1 to 4 of 4

Extract Specific Text From String

  1. #1
    Registered User
    Join Date
    04-01-2014
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    13

    Extract Specific Text From String

    Hello,

    I have a URL where I want to extract the specific text from part of the string, that text will differ in length but will always be between two points e.g.

    https://www.example.com/uk/?src=ppc-g&med=c-d&cmp=exa-xxx-xx-xxxx&off=xxxx&lp=xx&client=xx-xx-xx-xx,{keyword}

    The two sections are preceded by '?src=' and '&med=' and always finsihes at the ampersand that follows it, so above example it would extract 'ppc-g' & 'c-d'.

    Any clever excel user out there who can help create a formula that does this, 1 formula for each data extraction is fine as i will put them in two separate cells (unless i can use the same formula twice)

    Thanks!

  2. #2
    Forum Contributor
    Join Date
    07-13-2015
    Location
    Quebec, Canada
    MS-Off Ver
    2013
    Posts
    232

    Re: Extract Specific Text From String

    =MID(S22,FIND("?src=",S22)+5,FIND("&",S22,FIND("?src=",S22))-(FIND("?src=",S22)+5))
    =MID(S22,FIND("&med=",S22)+5,FIND("&",S22,FIND("&med=",S22)+1)-(FIND("&med=",S22)+5))

    With S22 being whatever cell you have

  3. #3
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Extract Specific Text From String

    Try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Where your URL is in A1, and "?src=" or "&med=" is in B1.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  4. #4
    Registered User
    Join Date
    04-01-2014
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Extract Specific Text From String

    Great, worked a treat.

    Thanks a lot!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Extract/return specific text from cell/string
    By JE2BD in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-02-2015, 05:32 PM
  2. extract specific text and number from a string at the same time
    By doctorexcel in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-09-2013, 04:30 AM
  3. Extract specific numbers from a string of text
    By Galwaygirl13 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-19-2012, 03:22 PM
  4. Extract specific word from a text string
    By krjoshi in forum Excel General
    Replies: 10
    Last Post: 01-19-2012, 02:00 PM
  5. Replies: 11
    Last Post: 09-29-2011, 04:42 AM
  6. Replies: 5
    Last Post: 05-03-2011, 09:35 AM
  7. [SOLVED] Extract specific value from a long text string
    By Dinesh in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-10-2006, 11:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1