Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Oct 05, 2020 06:24 PM
I’m trying to further customize a formula (that’s already working) with additional functionality to detect when text is missing a certain element and, in such cases, to then add that element to the text in a different column, but can’t seem to get anything to work.
Specifically, I have a formula that, among other things, takes a URL from, say, Column A, and then customizes/edits that URL in Column B based on criteria from data in other columns. In this instance, Column A is a URL field and Column B is the formula field, and Column B displays updated versions of URLs from Column A.
So far the formula is working fine except I also need it to detect when a URL in Column A is missing its trailing slash ("/") and to subsequently add in that slash where it would otherwise go when the URL appears in Column B.
I also don’t think it will be as simple as merely finding/replacing instances of <.com> with <.com/>, <.org> with <.org/>, <.co> with <.co/>, etc., since some URLs in Column A will have slugs.
A small number of use cases of the URLs in Column B will require a trailing slash in the URL and, inevitably, some users will on occasion neglect to ensure a URL has a trailing slash when they input the URL into Column A.
Solved! Go to Solution.
Oct 05, 2020 07:11 PM
Hi Kevin, Welcome to the forum! To check if there is a slash at the end of each URL, you could make use of the RIGHT() function:
IF(RIGHT(Column A,1) = "/",Column A,Column A & "/" )
It works like this: IF the one character furthest right is “/”, then do nothing, otherwise add a “/”
Oct 05, 2020 07:11 PM
Hi Kevin, Welcome to the forum! To check if there is a slash at the end of each URL, you could make use of the RIGHT() function:
IF(RIGHT(Column A,1) = "/",Column A,Column A & "/" )
It works like this: IF the one character furthest right is “/”, then do nothing, otherwise add a “/”
Oct 06, 2020 02:38 PM
Thanks for the welcome and for catching me up to speed on being able to leverage text functions I hadn’t previously used.
It wasn’t pretty working your suggestion into my preexisting formula but I stumbled upon a workaround that uses your advice and which seems to be getting the job done, so thanks.
Oct 06, 2020 07:59 PM
Glad you were able to use it!