SharePoint calculated column with a hyperlink

Using a hyperlink in a SharePoint calculated column to navigate to a different page. Here, I will show you how to add a SharePoint calculated column with a hyperlink in this SharePoint Online tutorial. Then, I will show you, how to apply the JSON format in the SharePoint calculated column to get a hyperlink.

In SharePoint Online, the calculated column does not show the clickable hyperlink. So, you can use JSON format to make a hyperlink clickable. For more information, you can read – Handling HTML markup in SharePoint calculated fields.

Suppose, you can see here, I have added a SharePoint list as “Training Courses,” and inside this, I have added two calculated columns with hyperlinks.

Add a SharePoint calculated column with a hyperlink

SharePoint calculated column with a hyperlink

Here, we will discuss how to add a SharePoint calculated column with a hyperlink. To achieve it, follow the below steps. Such as:

  • Open the SharePoint Online list, click on the + Add column and select See all column types. Then, click on the Next button like below.
SharePoint calculated column with a hyperlink
  • Then, on the Create Column page, enter the Column name (Website Full URL), and select the Data Type (Calculated).
SharePoint Online calculated column with a hyperlink
  • Now, add the formula under the Formula box as shown below.
="https://www."&Title&".com"
  • And you should select the Number data type to return from this formula. Then only we will get clickable hyperlinks. Then click on the Ok button.
How to add a SharePoint calculated column with a hyperlink
  • Now, add the title like the website name, now we will get a hyperlink without a clickable option like the one below.
How to add a SharePoint Online calculated column with a hyperlink
  • So, I have to use JSON format to make it clickable. Here, click or expand the calculated column. Then, click on the Column settings, and select Format this column.
How to create a SharePoint calculated column with a hyperlink
  • Next, click on Advanced settings, remove the column custom format, and add JSON format; then click on the Save button.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"target": "_blank",
"href": "@currentField"
}
}
How to create a SharePoint Online calculated column with a hyperlink
  • Once added the JSON format, then we will get a hyperlink like below.
Create a SharePoint calculated column with a hyperlink

Similarly, if you want a User-friendly URL, follow the steps below.

  • Open the SharePoint list, click the + Add column and select See all column types. Then, click on the Next button.
  • Then, enter the Column name on the Create Column page (User-Friendly URL). Select the Data Type (Calculated), and add the formula under the Formula box. Then Select the Ok button.
="Website URL"
Create a SharePoint Online calculated column with a hyperlink
  • Once, added the calculated column, it will look like below.
Add a SharePoint Online calculated column with a hyperlink
  • Now, we will remove the column custom format and add the JSON format. Then click on the Save button.
{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "a",
  "txtContent": "[$Title]",
  "attributes": {
    "target": "_blank",
    "href": "='https://www.' + [$Title] + '.com'"
  }
}
Create a calculated column with a hyperlink from SharePoint Online
  • Then, we will get a clickable hyperlink by using JSON format as shown below.
Add a calculated column with a hyperlink from SharePoint Online

This is how to add a SharePoint calculated column with a hyperlink.

Conclusion

This SharePoint Online tutorial taught us how to add a SharePoint calculated column with a hyperlink. And also covered how to apply the JSON format in the SharePoint calculated column to get a hyperlink.

You may also like: