Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Trimming parameters out of a URL string

Topic Labels: Formulas
Solved
Jump to Solution
837 2
cancel
Showing results for 
Search instead for 
Did you mean: 

I have a field that captures the URL for a webpage, but some URLs contain extra parameters after the .html part of the string.

How can I remove anything after the .html for those records but not have a blank cell if the URL does not contain parameters after .html?

I’d like a formula so that new field displays the URLs, just trimming the ?utm… part where needed:
https://www.test.com/page3.html?utm_campaign=hc-sc
https://www.test.com/page2.html

I figured out the trimming part using this formula, but not how to display URLs where there is no ?

LEFT({URL}, FIND("?", {URL}) -1)

Thanks!

1 Solution

Accepted Solutions

How about checking for the presence of the ? before providing a return value:

IF(
  FIND("?", {URL}),
  LEFT({URL}, FIND("?", {URL}) -1),
  {URL}
)

See Solution in Thread

2 Replies 2

How about checking for the presence of the ? before providing a return value:

IF(
  FIND("?", {URL}),
  LEFT({URL}, FIND("?", {URL}) -1),
  {URL}
)

Amazing. Thank you so much!