Fixing and/or Removing Excel Links

Linking Formulas are one of the most useful features of Microsoft Excel. These formulas allow you to share or ‘re-use’ data contained in one workbook with another workbook. The following is a textbook example of a linking formula: =[Book2]Sheet1!A3. In English this translates to “Show me the text and/or value that is being displayed in cell A3 on Sheet1 in the Excel file named Book2.” In a network environment the name of the file can include the full path name to the file, I:\HR\Budget\2014\[Book2]Sheet1!A3, for example.

What happens, however, if someone moves the file to a new location, renames the file or any portion of the path, or worse, deletes the file? The short answer is that Excel displays an error message that your linking formula no longer works. How you fix the problem depends on what was done.

Starting with the 2007 version Excel installs with automatic updating of linking formulas turned off by default. If you get the following error message when opening a workbook containing linking formulas you will know the setting for you machine.


Clicking on the Options button will display the following dialog box.


Obviously you have to check the lower radio button and then the OK button if you want to use linking formulas.

Assuming that you have automatic updating turned on, the following dialog box will appear whenever there is a problem with a linking formula.


If you click the Continue button the workbook will open normally, but the linking formula will not update. The linking formula will remain intact. You may want to choose this option if you are temporarily disconnected from the network. Clicking the Edit Links button will display the normal Excel File Open dialog box. You can then point to the new location for the file, or the new file name. The linking formula will be adjusted to the new location and/or name, retaining the same cell address.

In the worse case scenario, the file with the source data has been irretrievably deleted. In this situation you want to break the link, otherwise Excel will persist in displaying the previous error message each time that the workbook containing the linking formula is opened. To begin the process of breaking the link click the Edit Links icon on the Data tab of the ribbon.


This will display the following dialog box.


Click the Break Link button, which displays the following warning.


As the warning states, this will convert the formula to its current value, similar to using Paste Special==>Values. Should you need the linking formula you would then have to re-create it once the source workbook is re-created.

View VBA Consultants profile on LinkedIn

Copyright 2014 – VBA Consultants Ltd

Stop Excel’s #DIV/0!

#DIV/0! is not a comic book version of someone cursing. It’s the error message that you receive in an Excel worksheet whenever you attempt to divide by zero. If you remember grade school math class, zero divided by any number is zero. However, unless you were born on Gallifrey, dividing any number by zero is a mathematical impossibility. Since Excel cannot solve the formula, it returns #DIV/0! as shown in the following screen shot.


As you can see from this image, the #DIV/0! error cascades throughout the spreadsheet. Cells D8 and D10 return the same error message because one of the cells that is being summed and averaged contains the error condition. The error in cell D10 causes cell D12 to return an error. Although you cannot prevent a zero from appearing as a divisor in a formula, you can prevent the error condition from cascading by wrapping all of your division formulas inside of the IF function.

The basic structure of the IF function is: =IF(condition to test,return if true,return if false). In this example we want to test whether the numbers in column C equal zero. If they do, return the number zero. If they do not, perform the original division formula. As shown in the following screen shot, the division error messages have disappeared and the formulas in D8,D10, and D12 return an answer.


Notice that cells D5 and D6 both return zero, but for different reasons. One way to stop the error messages but yet not return the number zero is to enter some text as the true result from IF function. In the following example the IF function has been changed to display a dash (-) whenever the divisor is zero.


WARNING – although the SUM function in cell D8 returned the same answer in both of the two previous screen shots, the AVERAGE funtion in cell D10, and the formula in cell D12 have different answers, as highlighted in the red box. This is caused by the way Excel functions work. The SUM function treats text as a zero. Thus summing a cell containing a zero or a cell containing text results in the same answer. However, the AVERAGE function ignores any cells containing non-numerical data. Therefore the first IF example is averaging five cells, two of which contain zero, while the second IF example is averaging four cells, one of which contains zero. Depending on your application this could have a significant impact. [In these instances you may want to use the AVERAGEA function. This function treats text as a zero, similar to the SUM function.]

View VBA Consultants profile on LinkedIn

Copyright 2013 – VBA Consultants Ltd