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!

56 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
August 20, 2009 at 11:38 am
sanjaya
Hi,
Nice article ,if my list contains n number views,each views, i have to insert CEWP(java script code).is there any solution for this?
August 23, 2009 at 4:09 am
Christophe
sanjaya: the solution is to insert the script before creating the views. Once you have included a CEWP with the script in the main view, every new view you create based on the initial one will have the script included.
Btw to facilitate later updates it is recommended to store the script in a document library and link to it from the CEWP.
August 27, 2009 at 5:12 pm
Abhijit B
Hi,
We are having DailyTracker custom list to track daily project activities.In this list we have one column Department ( Type – dropdownlist ). Is it possible to open values appearing in Department dropdownlist as Lookup window similar to Person or Group window with option for user to select.
I am new to SPS 2007. Please help me out.
September 18, 2009 at 8:29 pm
Greg
Chris,
How would you do the opposite, i.e. extract the text value of a Sharepoint hyperlink?
Greg
September 20, 2009 at 12:58 pm
Christophe
Greg: I guess one solution would be to use a workflow to copy the hyperlink to a text column (but I haven’t tried).
Another approach would be to use a script that will run on the page to identify the html hyperlink and extract the link URL. I did something similar once to extract the item id from the title column.
October 23, 2009 at 4:44 pm
Troy
Christophe – looks like this thread has been going for a bit -
Glad I found it
I’m trying to simply copy the 1st part of the concat script and getting an error thrown back at me:
My Formula:
= CONCATENATE (“http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.”, [Title])
Error:
The formula contains a syntax error or is not supported.
Using:
WSS 3.0
Any ideas?
October 24, 2009 at 10:56 am
Christophe
Make sure you use normal quotes (not formatted quotes from Word for example). Other than that, I see no reason why it wouldn’t work.
October 28, 2009 at 3:44 am
Fayadh
Good day Chris, first of all this is a very useful article.
Here’s the scenario. I am building a pretty much like a records management system. For example I have created two lists, first is the List of Records, and the second one is the Request Form for the user to request any records.
In the List of Records, I have created a calculated column named “Request this”. My suggestion is when user click the “Request this” link it will link to the (2nd list)Request Form’s New Item. Then user can fill in the details and then submit the form.
Could u please help me in this area?
Much Regards,
Fayadh
October 28, 2009 at 12:28 pm
Christophe
Well, simply apply this post to your specific case, it is exactly the same scenario.
October 29, 2009 at 12:11 am
Fayadh
Thank you very much for the quick reply.
I have already solved the problem. Apparently, i use ‘&’ instead of ‘,’ for the CONCATENATE parameters and it works.
Thanks for the tips Chris. I have followed u on twitter.
Have a nice day!
November 6, 2009 at 11:19 pm
Robert B Sandoval
Christophe,
Strange, but I was able to reference the ID in my calculated column that creates a URL string. My URL link needed to include a unique page to which the user should return based on Region. It works nicely, but now I want to wrap it in a hyperlink. I’ve been trying to follow instructions but get the “error in formula” message.
Here is my URL output
https://mycompany.com/Lists/Directory%20List%20%20Operations/DispFormGSO.aspx?List=e67ab1c7%2D8f74%2D4959%2Da0ef%2D7bea2e4e638a&ID=202&Source=https://gain.paegroup.com/Lists/Directory%20List%20%20Operations/KeyOA05.aspx
and here is my formula…
=CONCATENATE(“https://mycompany.com/Lists/Directory%20List%20%20Operations/DispFormGSO.aspx?List=e67ab1c7%2D8f74%2D4959%2Da0ef%2D7bea2e4e638a&ID=”,ID,”&Source=https://gain.paegroup.com/Lists/Directory%20List%20%20Operations/”,[Calc aspx page])
I’ll continue banging at it. Is it required that I have a “Open in New Window” column?
November 7, 2009 at 2:20 pm
Christophe
SharePoint won’t give you an error message, but still ID is not in the list of allowed fields in formulas.
If you don’t need the “open in new window” part, just remove the IF from the formula.
November 7, 2009 at 7:05 pm
Anonymous
Christophe,
I appreciate the feedback. Got it to work. I broke out the calculated column into two calculated columns. However, I may have to try another approach using workflow and a hyper link field. Here is why…
The list in which I am trying to display the link is in datasheet view. When in DS view, the code is displayed. Is there a workaround for this other than the workflow option that I found here? (link and steps below)
Again, a BIG thanks.
===============================================
http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/65d37c53-116a-4405-aa7a-1aeff26ad3ff/
= = = = = = = = = = = = = = = = = = = = = =
What I normally do:
Create an optional hyperlink column in the list
Create a worklflow with SharePoint designer that starts on Item Created and with no conditions
In the workflow, create an “Store dynamic string” action and store into a new variable.
The dynamic string can then consist of your URL with lookups for any parameters you need. (Example: “http://www.google.com?q=[%YourItem:YourField%], Look up in google”. The comma and subsequent text makes sure it fits nicely with the Hyperlink data structure, where the latter part of the string becomes the displayed text for the link
Then add another action “Set field to value”, where you select the field from step 1 and for the value, the variable created in step 4.
Job done.
Proposed As Answer byKale Davis Wednesday, October 14, 2009 12:39 PM
March 1, 2010 at 9:14 pm
Anonymous
To use a regular link list how can we set this computing field please kindly advice. I am unable to get it working
February 1, 2010 at 4:05 pm
ShNg
You are my life saver!
March 25, 2010 at 4:16 pm
Bill
Question, my [title] column contains spaces which seems to cut off the URL when the first space is reached. Is there any way to account for spaces?
Great article btw.
October 31, 2010 at 1:48 am
JC
Hi Cristophe,
I followed your instructions but I can still see the tags and the clickable part it the one with the url. Here’s my syntax:
=CONCATENATE(““,idnumber,”“)
Kindly correct.
Thanks.
November 5, 2010 at 6:46 am
Christophe
JC, I’d recommend that you follow the links in the post, and read the troubleshooting page.
March 24, 2011 at 12:29 am
Sharon
Hello Christophe,
These instructions are exactly what I’m looking for and I’ve got it *mostly* working. The URL is formatted exactly like I want and have verified it will work. The only part not working is the script to transform it from text to html. I copied your script found in the link (http://blog.pathtosharepoint.com/2008/09/01/using-calculated-columns-to-write-html/), placed it in a text file and linked to it using the CEWP. Were there any changes you made to the script to get it to work on links instead of text formatting? Does the CEWP need to be last on the page or can it be first?
Thanks for your help.
March 28, 2011 at 7:29 am
Christophe
The CEWP needs to be placed below the text you want to modify. As for the script, the latest version is 2.1.1 .
April 10, 2011 at 4:55 pm
Sharon
Thanks, Christophe. That worked!
June 9, 2011 at 10:23 am
Manali
hello ,
Thanks for such article. i somehow cannot hide the long url that is diplayed in the calculated column. i have used custom new form for that particular list, and jqueries to create cascade dropdown.
do u think that the already existing jquery is preventing this from working? i have even added a webpart (courtesy you), TextToHtml. even it has not helped.
June 16, 2011 at 1:15 pm
Christophe
Well, it should work if you followed the instructions in this post and included the TextToHTML.
Test the customizations one at a time to try and isolate the issue. Sometimes the order may be important, I’d suggest for example to have TextToHTML before jQuery.
July 6, 2011 at 10:50 am
Manali
Yes. Thanks a lot Christophe. The order was the problem. Never thought it would matter.
June 23, 2011 at 2:56 pm
james
Hi Christophe,
Thanks for all your hard work. I love your solutions.
I have an extra field to add to my Concatenation and I had it worked out fine.
But when i go to try and enable the “Open link in new window” technique i just can’t get Sharepoint to accept my formula in URL column.
I’ve included the working sample below and if you’re not too busy i would really appreciate the help to get the Pop-Up window working.
=CONCATENATE(““,Status,”“)
Thanks very much
James
June 23, 2011 at 2:56 pm
james
=CONCATENATE(““,Status,”“)
June 28, 2011 at 11:35 pm
KTT
Thank you for all the suggestions on this page. My problem is somewhat different. I would like to use your suggestion of “open in a new window” but change it to “open on side frame”. How do I get a list in one zone to open one of my calendar vies on a different zone on the same page.
Thanks!
KTT
July 1, 2011 at 11:06 am
Christophe
While this can be done, I would not recommend to use my technique for this. You are mixing an item property with a page layout, and this is not consistent. Instead, I’d recommend to add a script to the page that will cnnect your hyprlinks to the frame.
July 6, 2011 at 4:45 pm
KTT
Thank you Christophe. Just a follow up question. Do you have an example I can show my boss?? Thanks!
July 12, 2011 at 10:33 am
Christophe
Sorry, I don’t. This is not specific to SharePoint, so you should be able to find examples on JavaScript sites.
October 26, 2011 at 7:21 pm
Rodolfo R. Rosales
Christophe, the [Title] column I am referencing has multiple words, and the subsequent URL refrenecing the [Title] breaking. ie.:
http://www.mysharepointsite.com/pages/my page.aspx (the URL is only linking to “http://www.mysharepointsite.com/pages/my”
Is there a work around, or is there just a common practice of not referencing columns with multiple text in it?
November 14, 2011 at 1:20 am
Christophe
In URLs, some characters need to be escaped. For example, you need to replace spaces with their encoded value:%20. In your example:
http://www.mysharepointsite.com/pages/my%20page.aspx