+ Reply to Thread
Results 1 to 6 of 6

Best way to sum totals for URLs with and without trailing slash

  1. #1
    Registered User
    Join Date
    07-09-2019
    Location
    Denmark
    MS-Off Ver
    2016
    Posts
    3

    Question Best way to sum totals for URLs with and without trailing slash

    Hi all,

    I'm reporting on our company's most-viewed pages. Most of our views involve a trailing slash (e.g. company.com/blog/) but there are always a portion of views that are attributed to a page without the trailing slash (e.g. company.com/blog). Google's Data Studio categorizes this as two separate rows, which throws off our reporting.

    As a temporary solution, what would be the best way to sum the totals of rows that are identical aside from one character (/)? I tried to think about something using VLOOKUP, but not sure.

    Here's some fabricated data to show what I mean:

    Page Pageviews
    /blog/blogA/ 50
    /blog/blogB/ 45
    /blog/blogB 10
    /blog/blogA 3
    Last edited by rf19; 07-17-2019 at 06:15 AM.

  2. #2
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Best way to sum totals for URLs with and without trailing slash

    VLOOKUP returns data, it does not sum.

    Perhaps you can use something like this:

    =SUM(SUMIF(A:A,{"company.com/blog","company.com/blog/"}))

  3. #3
    Registered User
    Join Date
    09-12-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2013
    Posts
    38

    Re: Best way to sum totals for URLs with and without trailing slash

    hi RF

    I'd suggest to add a column to replicate the page name and force a trailing / or remove, either way to make the lines be the same then use the sumif or a pivot tabl.

    so eg, column c formula =if(right(a1,1)="/",a1,a1&"/")
    this will put in a trailing slash if it's not there.

    Ron

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,824

    Re: Best way to sum totals for URLs with and without trailing slash

    You should also be able to use this to sum them up:
    =SUMIFS(B2:B5,A2:A5,"/blog/blogA*")

  5. #5
    Registered User
    Join Date
    07-09-2019
    Location
    Denmark
    MS-Off Ver
    2016
    Posts
    3

    Re: Best way to sum totals for URLs with and without trailing slash

    Thanks all for your replies. I think the issue with Gregb11 and 63falcondude's solutions is that they don't work neatly (as I can see) with the way I get the data. There are several hundred rows, and because the URLs with the trailing slash are the "main" pages, these will all cluster at the top. I basically just want to "top up" these rows with the pageviews of their counterpart URLs without the slash, which all cluster at the bottom of the dataset.

    Greg's solution returns nothing for the first rows (because it's looking for variations like /blog/blogA//), and I can't figure out how to get falcondude63's solution to dynamically update to the rows.

    In the end I think rondeondon's idea works best. Thinking it through, I ended up with this forumula instead:

    =SUM(B2,(IFERROR(VLOOKUP((LEFT(A2,LEN(A2)-1)),A:B,2,FALSE),0)))

    It uses VLOOKUP to find the pageviews for the URL without the trailing slash. This was then returning #N/A if it didn't find it, hence I added the IFERROR formula to add 0 if the slash-less URL wasn't found.

    So turns out something like this:
    URL Pageviews Combined Pageviews
    /blog/blogA/ 179 184
    /blog/blogB/ 126 131
    /blog/blogC/ 125 134
    /blog/blogD/ 124 139
    /blog/blogE/ 86 95
    /blog/blogD 15 15
    /blog/blogC 9 9
    /blog/blogE 9 9
    /blog/blogA 5 5

    I usually only report on the top 20 pages and there are hundreds, so as long as I make sure I'm reporting on the rows that have a slash (which include pageviews with and without slash), my reporting will be accurate.

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

    Re: Best way to sum totals for URLs with and without trailing slash

    A neater solution would be to use Power Query. Something like:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    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...

+ 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] Remove trailing spaces that aren't trailing spaces
    By kersplash in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-10-2018, 04:18 AM
  2. [SOLVED] Last word after last slash
    By makinmomb in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-23-2016, 06:41 PM
  3. [SOLVED] Slash as a text
    By luizmachado in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2016, 03:30 PM
  4. How do I make a zero appear with a slash
    By Bubey in forum Excel General
    Replies: 5
    Last Post: 09-06-2013, 08:06 AM
  5. Converting text URLs to hyperlinked URLs
    By ranchhand in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-25-2011, 01:46 PM
  6. Left of slash
    By jetsfan3261 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-21-2009, 12:15 PM
  7. [SOLVED] Zero with a slash
    By Stan in forum Excel General
    Replies: 7
    Last Post: 06-27-2005, 04:05 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