Help

Re: Find/Search an Empty/Missing Text String (Trailing Slash) and Substituting It

Solved
Jump to Solution
529 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Kevin_Elliott
4 - Data Explorer
4 - Data Explorer

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.

1 Solution

Accepted Solutions
Julian_E_Post
8 - Airtable Astronomer
8 - Airtable Astronomer

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 “/”

See Solution in Thread

3 Replies 3
Julian_E_Post
8 - Airtable Astronomer
8 - Airtable Astronomer

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 “/”

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.

Glad you were able to use it!