+ Reply to Thread
Results 1 to 11 of 11

How to crop a part of the URL using excel formula

  1. #1
    Registered User
    Join Date
    06-10-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    47

    How to crop a part of the URL using excel formula

    Hello,

    I am trying to find a way to crop a part of the URL using excel formula.

    For example below is my URL
    mysite.com/redirect?site=test&utm_content=my_test_content&headline=newfile&siteurl

    And i would like to copy whatever is after the utm_content parameter only. So using this example, i should get "my_test_content" in a new cell.

    Can someone help me with this please?

    Thanks
    Last edited by 99problems; 05-28-2016 at 06:05 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: How to crop a part of the URL using excel formula

    i would like to copy whatever is after the utm_content parameter
    What does that mean? What do you want to get when you crop the URL?
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to crop a part of the URL using excel formula

    Try this...

    =MID(A1,FIND("utm_content",A1)+11,100)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    06-10-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    47

    Re: How to crop a part of the URL using excel formula

    Quote Originally Posted by Tony Valko View Post
    Try this...

    =MID(A1,FIND("utm_content",A1)+11,100)
    Not working for me.

    @TMS, I am trying to copy "my_test_content" in a new column.

  5. #5
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to crop a part of the URL using excel formula

    Quote Originally Posted by 99problems View Post
    Not working for me.
    You said:

    copy whatever is after the utm_content parameter

    mysite.com/redirect?site=test&utm_content=my_test_content&headline=newfile&siteurl
    My formula returns:

    =my_test_content&headline=newfile&siteurl

    Which is what you asked for.

    If that's not what you want then tell us specifically what you do want.

  6. #6
    Registered User
    Join Date
    06-10-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    47

    Re: How to crop a part of the URL using excel formula

    Quote Originally Posted by Tony Valko View Post
    You said:


    My formula returns:

    =my_test_content&headline=newfile&siteurl

    Which is what you asked for.

    If that's not what you want then tell us specifically what you do want.
    Sorry i edited the question, I am trying to copy "my_test_content" in a new column. I am looking for a formula to copy the value after the "utm_content=" parameter only.

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to crop a part of the URL using excel formula

    Maybe this...

    =TRIM(LEFT(SUBSTITUTE(MID(A1,FIND("utm_content",A1)+11,100),"&",REPT(" ",100)),100))

    Returns: =my_test_content

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: How to crop a part of the URL using excel formula

    @Tony: that's why I asked the question. I thought like you but wasn't sure.

    @99problems: please don't edit earlier entries. It changes the context of subsequent points and the thread doesn't make sense.

  9. #9
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: How to crop a part of the URL using excel formula

    Not to step on toes here, but, taking both formulas that Tony kindly provided and making slight adjustment(s), they will return the
    "my_test_content" that OP wants.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Edit* I was just trying things out with the formulas so there might be a reason/(s) that it wont work for every URL on the sheet.
    Last edited by gmr4evr1; 05-28-2016 at 06:29 PM.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  10. #10
    Registered User
    Join Date
    06-10-2015
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    47

    Re: How to crop a part of the URL using excel formula

    Quote Originally Posted by Tony Valko View Post
    Maybe this...

    =TRIM(LEFT(SUBSTITUTE(MID(A1,FIND("utm_content",A1)+11,100),"&",REPT(" ",100)),100))

    Returns: =my_test_content
    Thanks Tony. This is exactly what i needed.

  11. #11
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How to crop a part of the URL using excel formula

    You're welcome. Thanks for the 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. Formula to move part of a value to a new cell - part 2
    By forestavekids in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 04-28-2016, 12:34 PM
  2. Replies: 1
    Last Post: 01-03-2016, 11:48 PM
  3. Bold part of Excel formula
    By MP1286 in forum Excel General
    Replies: 1
    Last Post: 10-06-2015, 04:42 AM
  4. Replies: 0
    Last Post: 05-06-2015, 04:25 AM
  5. Excel Macro Import web image, crop, and resize.
    By jdax57 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-17-2009, 08:30 AM
  6. formula to crop cell content?
    By HOLLYW00D in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-19-2007, 03:48 PM
  7. [SOLVED] Is there a way to crop text in an Excel cell?
    By cochranrg in forum Excel General
    Replies: 6
    Last Post: 12-13-2005, 11:10 AM

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