+ Reply to Thread
Results 1 to 7 of 7

Extracting a text string from a URL, almost there

  1. #1
    Registered User
    Join Date
    04-01-2014
    Location
    New York, NY
    MS-Off Ver
    Excel 2011
    Posts
    11

    Extracting a text string from a URL, almost there

    Dear Wizards.

    I have a problem that has just plain stumped me continually.

    I have a file with URLs in it (see attached). I want to extract the a string that starts just after "id=". I got this first part taken care of with the following formula:

    =SUBSTITUTE(MID(A7,FIND("id=",A7)+3,9),"/","")

    This works great when the extracted text is a total of 9 spaces. For example if part of the URL were:

    italy ca. 1880 /id=f_1097688/ref=lu91711097688/asking

    The formula returns perfectly: "f_1097688" Just what I want!

    But if the numeric part of this ID is shorter than 7 characters it returns to the 9th.
    If part of the URL were:

    white polka dot blouse/id=v_62437/ref=au120401247688/

    The formula would return, "v_62437r"

    I have tried altering the formula like this:

    =SUBSTITUTE(MID(A7,FIND("id=",A7)+3,9),"/r","")

    No luck.

    To make matters tricky I have ids with 1 through 7 numbers. More simply put I want everything after "id=" and before "/"

    Thank you so much for your help please see the attached spread sheet for sample data.

    Tim
    Attached Files Attached Files

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extracting a text string from a URL, almost there

    Hi,

    One way is the "quadruple find" method:

    =MID(A1,FIND("id=",A1)+3,FIND("/",A1,FIND("id=",A1))-(FIND("id=",A1)+3))

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting a text string from a URL, almost there

    Or this

    =LEFT(MID(A1,FIND("id=",A1)+3,10),FIND("/",MID(A1,FIND("id=",A1)+3,10))-1)
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting a text string from a URL, almost there

    @XOR LX

    LOL! they are almost identical

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extracting a text string from a URL, almost there

    Indeed!

  6. #6
    Registered User
    Join Date
    04-01-2014
    Location
    New York, NY
    MS-Off Ver
    Excel 2011
    Posts
    11

    Re: Extracting a text string from a URL, almost there

    Great minds think alike!

    Thank you very much gentlemen this I has been very educational comparing your two takes.

    Thanks again!

  7. #7
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extracting a text string from a URL, almost there

    Appreciate your feedback

+ 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. Extracting text from a string
    By AlexDeLara in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-26-2014, 04:41 AM
  2. Extracting numbers and text from inconsistent text/number formatted string
    By Brandivil in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-25-2013, 01:46 PM
  3. [SOLVED] Extracting Text from a string of Text & Digits of variable length
    By hastex in forum Excel General
    Replies: 6
    Last Post: 06-06-2012, 09:11 AM
  4. Extracting text from a string
    By excelhelp18 in forum Excel General
    Replies: 1
    Last Post: 04-05-2012, 03:08 AM
  5. Extracting just the last name in a text string
    By braydon16 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-06-2008, 08:19 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