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 columns 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 to 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 https://YOUR-web-app-url

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

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

  • It works in a list view but doesn’t seem to work in the form view — where it still only displays as uneditable text, Please can you advise?

  • Error in =CONCAT with closing single quotation.

  • Hello Mr.Rajack, thank you very much for this article. This solves my issue for creating the edit item hyperlink to launch the Power App form in a SharePoint Online list using a classic page view.
    But I have one problem. When I navigate to the second page of the view to see the next 30 items (from item 31 on), the jquery script doesn’t transform the calculated field to html anymore. The calculated field stays as text. The jquery script only translates the calculated field to html on the first view page that shows item 1 – 30.
    I check in Edit Page that the jquery script still exists on the classic view page. Do you know why and how to solve the issue for the second page view?
    Thank you very much.

  • Great solution. Will it work on a kanban board? On my board the link does not show.

  • Is there a way to conditionally leave it blank if there is no data in the field for the link?

    • This did the trick for me…if(@currentField != ”

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

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

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

  • 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?

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

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

  • 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>”)

  • 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”: “=’'”

  • Thanks for this. Worked well


Leave a Reply

Your email address will not be published. Required fields are marked *