Microsoft KB Archive/124634

= Microsoft Knowledge Base =

Excel: CELL Function Returns #N/A When Workbook Opened
Last reviewed: March 27, 1997

Article ID: Q124634

4.00 4.00a 5.00 5.00a 5.00c 7.00 | 4.00 5.00

WINDOWS                         | MACINTOSH kbusage

The information in this article applies to :


 * Microsoft Excel for Windows, versions 4.0, 5.0, 5.0c
 * Microsoft Excel for the Macintosh, versions 4.0, 5.0
 * Microsoft Excel for Windows NT, version 5.0
 * Microsoft Excel for Windows 95, version 7.0

SYMPTOMS
In Microsoft Excel, if you use the CELL function in a workbook, and a chart or module sheet has the focus when the workbook is opened, the CELL function may return the #N/A error value until you select and recalculate a worksheet.

Note that this problem will also occur in Microsoft Excel version 4.0 if the Workbook Contents Page has the focus.

CAUSE
Because the CELL function is a volatile function, if the "reference" argument (the second argument) in this function is omitted, the function is calculated based on the current selection. If the worksheet is part of a workbook, and a sheet other than a worksheet (for example a chart sheet) is active when the workbook is opened, all CELL functions in all sheets in the workbook will return #N/A until one of the sheets is selected and recalculated.

WORKAROUND
To have the CELL formula evaluate properly when the workbook is opened, use either of the following methods:

Method 1: Provide a "reference" argument for the CELL function, as in the

following example:

=CELL("address",A1) instead of =CELL("address"). Method 2: Select a worksheet to have the focus before you save the

workbook.

MORE INFORMATION
The CELL function returns information about the upper-left cell in a reference or currently selected range. Because a chart sheet or a Visual Basic module does not have cells or cell properties, this function returns the #N/A error value.

Note that this problem also occurs with the Workbook Contents Page in a Microsoft Excel version 4.0 workbook.