A lot is wrong in your code.
SUBSTITUTE does not exist for Calculated Columns
Besides that, you are mixing separators, using ; in your if statement (international notation) and , in your substitute
You CAN however have a Calculated Column outputted as HTML
PROVIDED YOU SET THE DATATYPE TO NUMBER
Then it is a matter of doing the replacement after the user clicks (so you can use Javascript) instead of doing it up front
="<a href='#' onclick=""alert('"
&Title
&"'.replace(/ /gi,'').replace(/\//gi,''))"">"
&Info
&"</a>"
Notes
- Besides the references to (exsiting columns!!!) Title and Info it is all one string;
so no worries with using ; or , parameters on international systems
- SharePoint strings start or end with ", so an escaped quote "" is needed to open de onclick definition and NOT close the SharePoint string.
Using a single quote here would make the single quote unavailable in
the JS code
- The Title is wrapped in single quotes so the JScode treats it as a String; otherwise
Javascript would look for a variable or function named in this rows Title field.
- The RegEx replace can be done much smarter but would be unreadable if you're not familiar with RegExs, so I left the 2 calls
replace the
alert( X )
with
document.location = X
to make it work like a link
and off you go
Wrapping an IF around it:
=IF(ISBLANK(TITLE),"","<a href='#' onclick=""alert('"
&Title
&"'.replace(/ /g,'').replace(/\//g,''))"">"
&Info
&"</a>")
Notes
- the IF formula parameter separator here is a , (comma)
test to see if you need a ; (semi-colon) on your local system
But only the ones in the ,"", SharePoint part!! The other commas are inside a string and Javascript interpreted
- I left the i (ignore case off the Regular Expressions search) not needed for space and /
Be Aware this is using the undocumented behaviour of setting a Calculated Column to datatype Number; if Microsoft changes this it might not work any more and you would have do to it the CSR/JSlink way.
But .. this method is less stressfull on both Server and Client; major difference being this code is downloaded for every ListRow whereas CSR code is downloaded once then called from every row. With just a few characters like in this link example, this approach is faster than CSR