Apr 20, 2020 09:44 AM
Hello, I have a formula for UTM and its pulling from the other columns in the sheet, but for some reason, it is not hyperlinking the entire URL. I not sure why, But I have doubled checked the formula to make sure there are no spaces. I am new to Airtable formulas so I am not sure what I am doing wrong. Thanks!
Solved! Go to Solution.
Apr 22, 2020 09:01 AM
@Zollie Typing is not too hard but rather time-consuming as I have been trying to fix this problem for about a week, with no solution. I am sure you could imagine how frustrating that is, especially on a tight deadline. Heres a read-only link : https://airtable.com/shr4GMQjgVpjd968A
let me know if it works. Thanks.
Apr 22, 2020 10:42 AM
Yes that can be frustrating. Sorry if my remark came off as flippant. The shared view helped a great deal.
The additional space characters are being introduced from multiple places:
(1) The formula itself
Whoever wrote it left some spaces in some of the strings (a string is anything with quotes around it). I’m not sure if those were intentional or not, but here it is without those additional spaces:
LOWER( {URL} & "?utm_medium=" & {Medium} & "&utm_source=" & {Source} & "&utm_campaign=" & {Campaign Name} & "utm_content=" & {Content})
(2) Single select fields that the formula relies on
Both “Source” and “Medium” have space characters added to some of the values - for example, “twitter” is "twitter ". There could be other fields with the same issue.
You could either keep a closer eye on any fields that the formula relies on, or build your formula to correct for user error. To remove spaces, you’d use TRIM, which removes leading or trailing space characters, or you could use a function like SUBSTITUTE to automatically replace any space characters with a hyphen (as you have with the “Campaign Name” field).
Examples:
TRIM({Source})
"Twitter " => “Twitter”
SUBSTITUTE({Content}, " ", “-”)
“Post With Image” => “Post-With-Image”
Putting it all together, you’d end up with this:
SUBSTITUTE( LOWER( TRIM({URL}) & "?utm_medium=" & TRIM({Medium}) & "&utm_source=" & TRIM({Source}) & "&utm_campaign=" & TRIM({Campaign Name}) & "utm_content=" & TRIM({Content}) )," ","-")
Apr 22, 2020 01:37 PM
Thank you @Zollie this is very helpful and informative I really appreciate it! I hate to be a bother but it’s still not working it’s telling me the formula is invalid which is strange. I am really not used to Airtable formulas. Heres what I am seeing :
Apr 22, 2020 01:48 PM
It’s working on this copy of the base you posted. I’ll keep that base up for a week so you have time to duplicate it and poke around.
Here it is again in case a typo was introduced:
SUBSTITUTE( LOWER( TRIM({URL}) & "?utm_medium=" & TRIM({Medium}) & "&utm_source=" & TRIM({Source}) & "&utm_campaign=" & TRIM({Campaign Name}) & "utm_content=" & TRIM({Content}) )," ","-")
But every now and then I have to write a formula by hand to get Airtable to recognize some of the field values.
Best of luck!
Apr 22, 2020 01:54 PM
It looks like there are a lot of curly quotes “ ”
in your screen captures. Change all of them to straight quotes "
.
This is a very common issue when copy/pasting formulas from the community.
Apr 22, 2020 02:04 PM
Thank you its working now! @Zollie I really appreciate all of your help