SharePoint Online: Format Calculated Column as Hyperlink

Requirement: Format Calculated Column markup as Hyperlink.

Using calculated column formulas to frame hyperlinks and setting the column type to “Number” renders the column markup as HTML. E.g. I’ve used this formula to link project documents with the Projects list.

=CONCATENATE("<a href=''",[ProjectID],">",[Project Name],"</a>")
convert calculated column to hyperlink in sharepoint online

Well, not anymore in SharePoint Online as per the Microsoft announcement Handling HTML markup in SharePoint calculated fields. SharePoint Online renders HTML markup as text instead of HTML!

sharepoint online render calculated column markup as html

So, How to render Calculated column as HTML markups in SharePoint Online? Here is how:

  1. Make sure the list is in New experience, Format the calculated column
    format calculated column as html in sharepoint online
  2. Use this JSON to format the column markup as HTML.
   "$schema": "",
   "elmType": "a",
   "txtContent": "Project Documents",
   "attributes": {
      "target": "_blank",
      "href": "='' + @currentField"

Similarly, you can refer any other fields in the list in JSON as:

"href": "='' + [$Project_x0020_Name]"

This JSON renders the text as HTML markup

sharepoint online render calculated column as html

Here is the Microsoft documentation on column formatting:

Format HTML Markup in Classic Sites

On Classic pages, edit the page in the browser, add a script editor web part and place this script in it.

<script src="" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
    var textholder = "";
    $("'<a href=')").each(function() {
        textholder = $(this).text();

How about SharePoint 2016/2019 On-Premises?
While the above steps work for SharePoint On-premises, You can configure it at web application level settings using PowerShell.

$WebApp = Get-SPWebApplication http://YOUR-web-app-url

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

10 thoughts on “SharePoint Online: Format Calculated Column as Hyperlink

  • July 20, 2021 at 5:45 PM

    In sharepoint 2013, If I wanted to create calculated columns that were hyperlinks would I follow these same steps?

    • September 9, 2021 at 1:14 PM

      For SharePoint On-Premises, You have to update a web application property!

      $WebApp = Get-SPWebApplication http://YOUR-web-app-url

  • September 30, 2020 at 2:01 PM

    Hi –
    thank you for this code, it’s really neat!
    I am an a Classic view and I can’t get this to work for the list when the view if Grouped by. Any suggestions?

  • September 8, 2020 at 3:55 PM

    How to add a list field in the “txtContent”: “Project Documents” section instead of a text

    • September 9, 2020 at 5:05 AM

      Say, If you want to display the value of “ProjectName” field instead of static text, use: “txtContent”: “[$ProjectName]”

  • April 24, 2020 at 11:33 AM

    Thanks very helpful, but please fix the code, single quotation shouldn’t be there in the first parameter of concatenate function, which is after this documents/’ instead, it should be in third parameter like this “‘>”
    =CONCATENATE(“<a href=’’ >”,[Project Name],”</a>”)

  • February 26, 2020 at 5:04 PM

    I can’t quite get this to work. I left the calculated column as is and even tried using some text rather than column variables and a hardcoded URL in my json and my value displays blank.

    “$schema”: “”,
    “elmType”: “a”,
    “txtContent”: “TEST”,
    “attributes”: {
    “target”: “_blank”,
    “href”: “=’'”

  • February 6, 2020 at 6:46 PM

    Thanks for this. Worked well


Leave a Reply