Please Note: This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Dynamic Hyperlinks in Excel.

Dynamic Hyperlinks in Excel

Written by Allen Wyatt (last updated April 15, 2020)
This tip applies to Excel 2007 and 2010


8

You can create dynamic hyperlinks in Excel that act like HTML forms without having to know much at all about HTML. These hyperlinks can come in handy when using Excel as an interface to the Internet or to an internal Web.

As an example, let's create a Google search form. First, drop by Google.com and do a search for the keyword "Excel." Then, take a look at the URL in your browser's address bar. It may look something like this:

http://www.google.com/search?hl=en&q=Excel&lr=lang_en

Of course, what you see in the address bar could be even longer, depending on what server you end up accessing at Google:

http://www.google.com/#hl=en&sugexp=ldymls&xhr=t&q=Excel&cp=4
&pf=p&sclient=psy&site=&source=hp&aq=0&aqi=&aql=&oq=Exce&pbx=1
&bav=on.2,or.r_gc.r_pw.&fp=e28a97840bb57e9&biw=1311&bih=692

Regardless of the format shown in the address bar, if you study what you see, you'll start to recognize patterns. The parameters following either the question mark (?) or the hash mark (#) are the name-value pairs submitted by the HTML form. But, you don't need to know a whole lot about that. In this case, the main thing to consider is the search term, where "q" is the name of the parameter and "Excel" is the value.

Using the HYPERLINK function along with the CONCATENATE function (or just the ampersand, &), you can easily assemble a link and create a dynamic form using cells as fields. Just follow these two quick steps:

  1. In cell B3 enter the keyword "Excel Web Queries."
  2. In cell B4, enter the following formula:
=HYPERLINK("http://www.google.com/search?q="&B3&"&safe=active","Search Google")

Now you have your own simple HTML form inside of Excel. You can create much longer hyperlinks and include multiple cell references, but there is a limit in Excel to how long the hyperlink can be (about 248 characters). To use the form, just enter your keywords into cell B3 and click on the hyperlink in cell B4. That's it!

Creating a form to access Google is just a simplistic example. The interesting applications are when you can assemble hyperlinks from the results of calculations, string manipulation, IF statements, combo boxes, or the other form fields available in Excel.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (179) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: Dynamic Hyperlinks in Excel.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Showing Text when a Cell is Empty

Wouldn't it be great if you could have Excel display some text in a cell only when that cell is empty? Unfortuantely, ...

Discover More

Bypassing the BeforeClose Event

Hold down the Shift key as you open a workbook, and Excel bypasses any "startup macros" that may be in the workbook. If ...

Discover More

Throwing Out the Lowest Score

Want to add up a bunch of scores, without including the lowest one in the bunch? You can make a small change to your ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Sending Single Worksheets via E-mail

Got a single worksheet that you want to e-mail to someone, but don't want them to see the rest of the worksheets in the ...

Discover More

Creating a Dynamic Hyperlink

Want to create a hyperlink that will always display a different worksheet in your workbook? There are several ways to do ...

Discover More

Excel Freezes when Removing Hyperlink

Excel should allow you to both add and remove hyperlinks in a worksheet. If you run into problems removing hyperlinks, ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 2 + 8?

2019-11-10 10:39:27

J. Woolley

@Big Al
Use Notepad to create the following CMD script text file and save it as OpenLinks.cmd:

@echo OFF
start http://A.html
start http://B.html
start http://C.html
start http://D.html

Change A, B, C, D to represent the 4 web sites you want to open.

Select the Excel sheet's cell containing the single hyperlink you want to edit and press Ctrl+K. On the left side of the Edit Hyperlink dialog box, pick Existing File or Web Page, then pick Current Folder. Navigate to the folder containing OpenLinks.cmd and pick that file for your hyperlink's Address. You can also update Text to Display and ScreenTip if desired.

When the OpenLinks.cmd hyperlink is opened you will see a warning message; click OK and all 4 web sites will open.


2019-11-10 02:17:17

Big Al

Hope this is an appropriate place to ask: Running Office 365. I copied some info from a webpage to excel. This included a single hyperlink in the cell data. Is there a way to add more hyperlinks so that this single cells data opens 4 separate but related web pages? I can edit the hyperlink by right clicking (link doesnt show in Formula Bar), I tried simply entering a comma and the second link but that didn't work.
Any help gratefully received,


2018-05-24 13:31:41

Naoko

THANK YOU this worked.
I was looking for a solution for a Google spread sheet with around 3,000 data.
I spent nearly 4 hours for try and error and finally done.

Cheers from Italy,


2018-01-09 16:19:24

John

Figured it out - just had to add extra quote marks around the end.

=HYPERLINK("http://www.google.com/search?q="&B3&"&safe=active",""&B3&"")


2018-01-09 15:28:03

John

Thanks for this - VERY helpful. One more question - for the link: =HYPERLINK("http://www.google.com/search?q="&B3&"&safe=active","Search Google")

is there a way to show the value in cell B3 instead of "Search Google"?


2014-06-13 08:51:46

Hannan

I need some help.
In a sheet i want to put a formula thta facilitate the dynamic search result from web and then return the result.

I have a value in Dollar in Cell A1 in Cell A2 i need that it goes to google search 1 USD into CAD and then with the resultant value multiply the value in A1 and display in A2.

Is there a way out for this?


2014-05-22 13:11:22

awyatt

Robert: You are getting an error because you have an ampersand (&) before the comma.

This statement of mine assumes that you want to concatenate the contents of cell B113 to the hyperlink. If that is not your intent, then you hyperlink is quite messed up. There should be a single set of quote marks around the entire hyperlink (Excel requires this) and a separate set around the hyperlink text.

-Allen


2014-05-22 12:52:45

Robert

Hi, a very nice solution to a common usage question.

I have tried following your tip with the following formula entry

=HYPERLINK("https://kc.mcafee.com/corporate/index?page=content&id=KB"&B113&, "Go to the article")

To which I get a very non-descript "Your formula has an error" type response, or just flatly ignored and the entire formula is shown in the cell. No link and entering the article number in the cell indicated gets nothing done. Any ideas?


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.