Google-sheets – Formula for Adding Text to End of Cell (contains URL) – How to account for cells ending both with and without a “/”

formulasgoogle sheets

Working in Google Sheets, I have a column with a list of URLs. I'm trying to add a column that automatically populates the blog link (all sites end in "/blog").

However, my list of URLs are formatted differently, some ending with / and some without.

I understand how to add "blog" to the URL structure automatically (=C2&"/blog"), but how can I tell the cells to look at whether a "/" is already at the end or not, in order to populate "/blog" or "blog" accordingly?

Best Answer

Use RIGHT(C2,1) to get the last character
The use IF to add "/" in case that it's required

Example

=C2&IF(RIGHT(C2,1)<>"/","/","")&"blog"