Cookie Consent by Free Privacy Policy Generator

How to Compare URIs in Google Sheets Using a Formula

When working with URLs in Google Sheets, sometimes you want to compare just the URI (the part after the domain) and ignore the domain and protocol (like http, https, or www). Here's a handy formula that does exactly that—extracting the URI and checking if it's the same across different columns.

Screenshot 2024-09-18 103419.png


Code:
=IF(AND(MID(A2, FIND("/", A2, 9), LEN(A2)) = MID(E2, FIND("/", E2, 9), LEN(E2)), MID(A2, FIND("/", A2, 9), LEN(A2)) = MID(H2, FIND("/", H2, 9), LEN(H2)), MID(A2, FIND("/", A2, 9), LEN(A2)) = MID(K2, FIND("/", K2, 9), LEN(K2))), "Match", "No Match")

How It Works:​

  • FIND("/", A2, 9) locates the first / after the domain name, assuming the domain starts after the first 9 characters. This works for both http:// and https://.
  • MID(A2, FIND("/", A2, 9), LEN(A2)) extracts the URI (everything after the domain) from the URL.
  • The AND function compares the URIs from columns A, E, H, and K.
  • If all the URIs match, it returns "Match". Otherwise, it returns "No Match".
This approach is especially useful if you’re dealing with variations in URLs across different sources, for example, the URIs in the hreflang alternate URLs, but we only care about the specific page path, not the domain. It’s a quick way to spot discrepancies or confirm consistency without having to run full crawls.
 
Back
Top