To make a hyperlink enabled or disabled depending on a certain condition, use it together with the IF() function. For example:
=IF(C1="May",HYPERLINK("[D:\Sales.xlsx]May!A1","Sales"),""
Automatic changes of a hyperlink depending on the value in a cell can easily be implemented using the IF() or CHOOSE() function. For example, do the following:
- Create and save on drive D: the following Microsoft Excel workbooks: May.xlsx, June.xlsx, July.xlsx.
- Open a new workbook and enter the following formula in cell A1:
=CHOOSE(1, HYPERLINK("D:\May.xlsx","May"), HYPERLINK("D:\June.xlsx","June"), HYPERLINK("D:\July.xlsx","July"))
- Make sure that cell A1 displays the hyperlink May. When you click it, the corresponding file located on drive D: will open.
- By changing the index (the first argument) in the CHOOSE() function to 2 or 3, check the transition to the hyperlinks for the files June.xlsx or July.xlsx, respectively.