When dealing with hyperlinks in SharePoint, users often point out the two following limitations:
- in a links list, there is no option to open a link in a new window.
- When using calculated columns to build URLs, the result is not displayed in a user-friendly way.
There are various methods to work around these limitations. Today I am going to show mine, which has the advantage of only using the SharePoint UI (no need for SharePoint Designer).
The issue
To understand the issue, let’s build a list of links pointing to the Microsoft SharePoint newsgroups:
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.design_and_customization
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.development_and_programming
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.general
http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.setup_and_administration
First, we create a custom list (Site Settings > Create > Custom list), call it “Microsoft newsgroups”, and add these four items:
sharepoint.design_and_customization
sharepoint.development_and_programming
sharepoint.general
sharepoint.setup_and_administration
The second step is to create a calculated column to build the links to the newsgroups:
Name: “URL”
Type: Calculated column
Formula:
= CONCATENATE ("http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.", [Title])
Let’s take a look at the result:

As expected, we have been able to build our URL, and the browser has interpreted it as a hyperlink. But the display is not very user-friendly. We’d prefer to just see the titles, for example “sharepoint.general”.
Building an user-friendly list of links
To achieve this result, I am going to apply to the above list my method: using calculated columns to write HTML.
This is the HTML I need (Title displayed, and on click open URL):
<DIV><a href=”URL”>Title</a></DIV>
So in SharePoint I am going to change the [URL] formula to this:
=CONCATENATE("<DIV><a href='","http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.",Title,"'>",Title,"</a></DIV>")
Now, the final touch: add the script to convert the string to HTML (how?), and you should now see this:

What is still missing is the option to open the link in a new window. Here are the steps:
- create an additional column in your list:
Name: “Open in new window?”
Type: Yes/No (check box)
- change the formula in the URL to this:
=CONCATENATE("<DIV><a href='","http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.",Title,IF([Open in new window?]=TRUE,"' target='_blank' ","'"),">",Title,"</a></DIV>")
Here is the final formula in clear (but you should actually copy/paste the above one):
=CONCATENATE(”<DIV><a href=’”,”http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.”,Title,IF([Open in new window?]=TRUE,”‘ target=’_blank’ “,”‘”),”>”,Title,”</a></DIV>”)
As usual, feedback is welcome!

24 comments
Comments feed for this article
September 3, 2008 at 5:27 pm
EndUserSharePoint.com: How to create links, labels and coloring in a SharePoint list : End User SharePoint
[...] A second desire for many people is to have a hypertext link within a calculated column that does not show the link, just the label. The question comes up almost daily. Christophe use the Concatenate function to string everything together in How to Open Hypertext in a New Window (Or Not). [...]
September 8, 2008 at 2:24 pm
Anonymous
Does this work in WSS? I cannot copy your link as you indicate but I copied the text that is displayed. I get an error message, just wondering if it is ok with WSS?
September 8, 2008 at 3:43 pm
Christophe
Yes, this works in WSS.
Due to the page formatting, the end of the formulas is hidden. You should still be able to select the whole formula with a triple click.
If you use the formula in clear at the end of the post, type it yourself in the calculated field, do not copy/paste.
If you have any doubt, feel free to send me the formula you used(Christophe@PathToSharePoint.com) and I’ll double check it.
September 10, 2008 at 4:31 am
Mark Miller
Christophe – When creating a link, I’d like to be able to use the [Name] column (file name), but [Name] is not an available column when creating the calculated string. Is there a way to access the [Name] column in the formula so that it won’t have to be hardcoded?
=CONCATENATE(”",Name,”")
September 10, 2008 at 6:12 am
Christophe
Sorry Mark, I am not aware of a way to use [Name] in calculated columns. Same issue for fields of type hyperlink, picture or lookup.
If you don’t want to take the SharePoint Designer path, a trick would be to include some JavaScript in the upload form, that would capture the name and copy it to another field. This is risky, as changes happening outside the upload form (for example in explorer view) wouldn’t be captured.
September 10, 2008 at 10:42 am
Anonymous
Hi, I had tried the method but couldn’t get it.
Actually I’m trying to navigate my task records when I’m in the view/edit screen. I created a Calculated field with formula, =”http://sharepoint.teleatlas.com/sites/apac/GDPtest/Lists/Tasks/DispForm.aspx?ID=”&(ID-1), and I just want to display it as “Previous Rec” instead of the whole hyperline.
Could I know how to do it?
Thanks
September 10, 2008 at 12:47 pm
Christophe
Interesting idea, but… unfortunately you cannot use the ID field in a formula. See a list of restrictions here:
http://pathtosharepoint.wordpress.com/2008/08/07/calculated-columns/
The formula would have been something like this:
=CONCATENATE(”[a href='http://sharepoint.teleatlas.com/sites/apac/GDPtest/Lists/Tasks/DispForm.aspx?ID=", ID-1, "' rel="nofollow"]Previous record[/a]“)
(replace brackets with angle brackets)
September 12, 2008 at 5:12 pm
Antonio
Hello
Is it posible to remove the filtering row on top on the data rows? I’m using this trick to create a menu with links to other pages but I don’t like showing the name of the field as a filtering row. I don’t want people filtering the view.
I’m using WSS 3.0.
Best Regards
September 13, 2008 at 1:34 am
Christophe
Antonio, why wouldn’t you let people filter the view if it helps them?
I don’t see an easy way without SharePoint Designer.
As you are looking for a menu, have you tried this alternate option:
http://pathtosharepoint.wordpress.com/2008/08/20/a-simple-drop-down-menu/
September 15, 2008 at 9:28 am
Antonio
Christophe, first of all thank you for your support.
I’m using one links list for the whole site. The site has a lot of differente pages (it’s an Intranet) and each page has a link web part. In order to avoid a lot of links lists, I’ve just created one with some fields that work as filters. So when anyone creates a new page and needs a links list, the common links list is used and the user creates a new view for than page.
In that case, the user shoudn’t be filtering, as what he’s seeing is the linsk for the specific page.
Is it posible with Designer? Although I don’t have the tool I could ask some guys from other department to see if they can made the changes.
Best regards
September 15, 2008 at 9:57 am
Christophe
SPD will remove whatever you want in a snap. Problems usually start when you realize you have removed too much… If you are not familiar with SPD, ask for advice first. On this blog you can start with my article on the Data View Web Part:
http://pathtosharepoint.wordpress.com/2008/08/24/your-first-data-view-web-part/
Next month I’ll publish more articles on menus, hope you’ll find something to your taste.
September 15, 2008 at 2:09 pm
Antonio
Thank you, Christophe, I will give it a try.
November 20, 2008 at 9:29 pm
Steve
Christophe, this does not seem to be working for me. I entered the following to test if it would work:
=CONCATENATE(”TEST“)
But all got was the following line in the Column.
TEST
I should expect only the word “TEST” in the column, correct? And if I press it, then it should should direct me to the url. Not working as expected though. Any help would be appreciated.
November 20, 2008 at 10:35 pm
Christophe
Steve, there’s a troubleshooting section here:
http://pathtosharepoint.wordpress.com/2008/11/01/troubleshooting-your-html-calculated-column/
If it still doesn’t work, send me your formula by e-mail.
November 25, 2008 at 5:56 pm
larry
So here is a question. When I set up new sites, on the home page I had a links list setup so users can add their own links and it would only display thier links, like a My Links view. When you add this link to the web zone it removes the column headers and creates a bulleted type list of the links. I created this custom list added it and it works perfectly, but I can not remove the column header, and I am not sure How I can make the view display as a bulleted list. Can this only be done with a links list?
November 26, 2008 at 1:33 am
Christophe
Larry, I also tried a “My Links” view in a department, but it never worked. People sticked to their browser bookmarks.
Are you saying that you used the method described in this post? In this case, you should be able to get the bullets by adding a “li” tag in the formula.
I often see questions about modifying the look of Web Parts (title background, remove buttons, hide column header), and I’ll publish a script for this. I have no magic trick, just regular CSS.
What I usually do in such cases is create the view from scratch. For a list of links, I would for example:
1/ grab the list content using the URL protocol:
http://pathtosharepoint.wordpress.com/2008/09/24/using-the-rpc-method-via-the-url-protocol/
2/ use Javascript to make it a drop-down menu, like here:
http://pathtosharepoint.wordpress.com/2008/08/20/a-simple-drop-down-menu/
November 26, 2008 at 6:31 pm
larry
Duh, I should have thought about the li tags. That is simple enough. Ireading the rest of your solution I guess I was making it harder that I should. Sorry now I will shut up. Thanks again. If you are in the states, have a great holiday!
April 1, 2009 at 12:21 pm
Sheena
Hi…
I want that my hyperlink should ALWAYS open in a new window. Also tell me if there is any way to HIDE a column…
Plz let me know about this asap…
April 27, 2009 at 2:49 am
Patrick
Nice one but your article on this isn’t clear enough.
You stated:
First, we create a custom list (Site Settings > Create > Custom list), call it “Microsoft newsgroups”, and add these four items:
sharepoint.design_and_customization
sharepoint.development_and_programming
sharepoint.general
sharepoint.setup_and_administration
What type of colmn fields did you create e.g single line of text,hyperlink etc….
I have created a calculated column and i have pasted this sample link
=CONCATENATE(”Previous record“)
But if i do:
=”http://wknt250:8182/sites/TeamSite1.aspx?k=”&Title
I can get a link but i want a link like the one you created
Thanks
April 27, 2009 at 3:16 am
Patrick
Do i need any javascript for this to work?
May 27, 2009 at 7:15 pm
Chelsea
Hi Christophe,
I followed exact your steps
1.
2.
Formula:
= CONCATENATE (“http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.”, [Title])
And I got this error message:
“The formula contains syntax error or is not supported”
Did I miss something?
May 28, 2009 at 12:44 am
Christophe
Chelsea, I think the issue is with quotes formatting. I have corrected the post, note the subtle difference with what you pasted in your comment.
June 4, 2009 at 6:30 pm
Todd
How are you disabling output escaping? I actually see the code with the div tags etc.
June 4, 2009 at 6:34 pm
Todd
NM, found your link. Thanks