This can be handy if for example, you only want a list of products and they reside on folders that are 3 “/” deep into your URLs/Domain
For example:
- Myshop.com/categorypages/subcategorypage/productpage/
I only want the URLs that reside at the third level – i.e. /productpage/
- Go to your XML sitemap – usually at Myshop.com/sitemap.xml
- Right click and “save as” – save on your computer
- Open Excel
- Go to the Developer Tab (you might need to add this as it’s not there by default)
- Click “Import”
- Browse to find your sitemap.xml and import it into Excel
- This usually pulls all your URLs into column 1 and other info like priority into separate columns
- Delete all the columns except the first one with your URLs in it
- Remove the https:// from the URLs with “find and replace” – On “Home” tab under “Find & Select” on the right
- In cell B2 add the function:
=LEN(A2)-LEN(SUBSTITUTE(A2,"/",""))
11. Drag the formula down the rest of column B
12. You can now order column B by the number of “/” found in each URL
If different categories have different folder structures then you can conditionally format and use different colours for different categories and then do a multiple criteria sort – by colour, then folder depth (column B)
You can download an example spreadsheet with the formula in here