+ Reply to Thread
Results 1 to 10 of 10

URL and text percentage

  1. #1
    Registered User
    Join Date
    08-20-2018
    Location
    Greece
    MS-Off Ver
    MS Office 365
    Posts
    5

    URL and text percentage

    Im currently trying to find the relevance percentage of URL and the page title.

    Example: URL: mysite*dot*com/Understanding-URL-Parameters/index.html
    Page title: Technical Guide: URL Parameters

    Im looking for something that will be able to check the path after mysite*dot*com and return a percentage match of the path and the page title.

    Understanding-URL-Parameters : Technical Guide: URL Parameters (60%)

    After research ive found similar scripts but none fit my situation as they would get character percentage and word percentage, the word would fit perfectly but the percentage would take into account the mysite*dot*com and the dash (-) in the URL would cause the script to return inaccurate results.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: URL and text percentage

    Here is a method that compares number of character matches.
    Please Login or Register  to view this content.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    08-20-2018
    Location
    Greece
    MS-Off Ver
    MS Office 365
    Posts
    5

    Re: URL and text percentage

    Hello dflak,

    Thanks for the script, how do you import the url and title from a cell?
    i looked into it, but i couldnt make it through. Im not familiar with vb.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: URL and text percentage

    In this code, I did not import the data; I actually passed hard-coded strings. I'm sorry if I threw you off by having the URL and Title also on the spreadsheet. Originally I did intend to import it.

    The syntax for reading data form a cell is relatively simple. In general:
    Please Login or Register  to view this content.
    For example
    Please Login or Register  to view this content.
    However, GetPercent is a function. You can call it from Excel directly. If the URL is in B2 and the Title is in B3 than =GetPercent(B2,B3) will get you the percent.

  5. #5
    Registered User
    Join Date
    08-20-2018
    Location
    Greece
    MS-Off Ver
    MS Office 365
    Posts
    5

    Re: URL and text percentage

    Quote Originally Posted by dflak View Post
    In this code, I did not import the data; I actually passed hard-coded strings. I'm sorry if I threw you off by having the URL and Title also on the spreadsheet. Originally I did intend to import it.

    The syntax for reading data form a cell is relatively simple. In general:
    Please Login or Register  to view this content.
    For example
    Please Login or Register  to view this content.
    However, GetPercent is a function. You can call it from Excel directly. If the URL is in B2 and the Title is in B3 than =GetPercent(B2,B3) will get you the percent.
    You are correct i missed that using the function directly from the cell is much easier thanks.

    For some reason it works with my given example but whenever i try a different domain it always returns 0.
    The example works correctly on cell and on msgbox anything else wont, tried removing www or http but nothing.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: URL and text percentage

    Attach the workbook with the domain that is giving the issue, I can step through the code and see where it is failing.

  7. #7
    Registered User
    Join Date
    08-20-2018
    Location
    Greece
    MS-Off Ver
    MS Office 365
    Posts
    5

    Re: URL and text percentage

    Hey dflak im attaching a random one,

    Ive tried with couple of domains and nothing seems to do the trick so far.

    Thanks!

    EDIT: I found the reason, when a URL has more than 1 slash (directories) the script wont work.
    Attached Files Attached Files
    Last edited by nap013; 08-22-2018 at 03:41 AM.

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: URL and text percentage

    https://www.beatsbydre.com/uk/speakers/beats-pill-plus

    There are 6 "parts" to this URL. What part do you want to match?

  9. #9
    Registered User
    Join Date
    08-20-2018
    Location
    Greece
    MS-Off Ver
    MS Office 365
    Posts
    5

    Re: URL and text percentage

    Im trying to match the whole path after .com so on every URL it would be different.

    sorry if i didn't made that clear!

  10. #10
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: URL and text percentage

    This function splits the URL into parts by "/" and title by " " (after substituting punctuation). Then it compares URL parts to Title parts and adds the length of the title parts to a running count. Since this is a "double loop," things get counted twice so I divide by two.

    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. [SOLVED] Percentage of a text list
    By andreu in forum Excel General
    Replies: 2
    Last Post: 01-25-2014, 12:58 AM
  2. [SOLVED] If a cell has a text value then next one must have a percentage.
    By Gregwaa in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-11-2013, 09:35 AM
  3. IF - OR - nested with percentage & text
    By Bill tznt in forum Excel Formulas & Functions
    Replies: 21
    Last Post: 02-10-2013, 03:16 PM
  4. [SOLVED] Replace text with Num and do a Percentage?
    By dksodhi in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-13-2012, 10:14 AM
  5. Text to display percentage
    By Saturn in forum Excel General
    Replies: 3
    Last Post: 08-07-2011, 09:17 AM
  6. Converting percentage into text value?
    By Bandolin in forum Excel General
    Replies: 4
    Last Post: 05-29-2009, 01:52 PM
  7. Concatenate text w/ a percentage
    By dbrunner281 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2007, 09:29 AM
  8. Convert Percentage to Text
    By Kinjalip in forum Excel General
    Replies: 2
    Last Post: 09-28-2005, 09:05 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