Excel.Tips.Net Welcome toExcel.Tips.Net

Helpful Links

Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment

Tips.Net Store

ExcelTips FAQ
ExcelTips Premium

Learn Access Now
Free Printable Forms

Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips

Advertise on the
ExcelTips Site

Newest Tips

Recording a Macro

Adding a Little Animation to Your Life

Converting a Range of URLs to Hyperlinks

Making the Formula Bar Persistent

Engineering Calculations

Digital Signatures for Macros

Fixing the Decimal Point

 

Iterating Circular References

Summary: Circular references often, but not always, represent a mistake in the logic of your workbook. If you purposefully add a circular reference, you can configure Excel to treat that reference in a particular way. This tip explains how that configuration is done. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, and Excel 2003.)

Circular references occur when a formula refers--either directly or indirectly--to the cell in which the formula is stored. For instance, if B3 contains the formula =B2+B3, then B3 contains a circular reference.

Normally, circular references represent a mistake in a formula. There are some situations in which circular references are desirable, however. Excel allows you to include circular references in a worksheet, but it can get a bit picky about them.

For the most part, Excel is very lenient about circular references if you have the Iteration control turned on. (Choose Options from the Tools menu and display the Calculation tab. (Click here to see a related figure.) ) If you select the Iteration check box, and then enter a circular reference, then Excel doesn't protest. Instead, it uses the settings on the Calculation tab to control how many times the circular reference is repeated before it is considered done.

It appears that the setting of the Iteration check box is stored as part of a workbook, but it is not always paid attention to when the workbook is later loaded into Excel. In fact, the setting is ignored completely if any of the following occur before you open the workbook:

  • You open any other workbook beside the default workbook created when you first start Excel.
  • You change the Iteration check box while the default workbook is displayed.

What Excel does is to examine the Iteration check box setting for whatever workbook you first open. That setting becomes the "default" for the current session with Excel. For any other workbook loaded during the same session, the saved setting of the Iteration check box is ignored.

In addition, if you have a Personal.xls workbook defined on your system, then the setting of the Iteration check box within that file is always used as the default. Why? Because Personal.xls will always be the first workbook opened, and the first workbook opened always defines the default for the setting.

If you have a saved workbook that uses circular references, and the Iteration check box is cleared (either by default or explicitly), then when you open the workbook containing the circular references, Excel displays a warning. If you don't want to see the warning, then the obvious solution is to either make sure that you open the workbook before any other workbook (so that its Iteration setting is used) or explicitly set the Iteration check box before opening the workbook.

If you don't want to bother worrying about which order you open workbooks, and you don't want to always go change the setting of the Iteration check box, you can create a macro that ensures the Iteration check box is selected for the workbook. If you assign the macro to the Open event for the workbook, then it will run every time the workbook is opened, ensuring that you won't see the warning you don't want to see. The macro appears as follows:

Private Sub Workbook_Open()
    Application.Iteration = True
End Sub

If you have a Personal.xls workbook defined for your system, you can add this macro to it instead of to individual workbooks. In that way you can ensure that the Iteration check box is always selected for every Excel session.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2816) applies to Microsoft Excel versions: 97 | 2000 | 2002 | 2003

Tame Your Data! ExcelTips: Filters and Filtering provides all the details necessary to let you manage large sets of data with confidence and ease. Its information-packed pages demonstrate how to use the two types of filters provided by Excel: AutoFilters and advanced filters.
 
Check out ExcelTips: Filters and Filtering today!