Excel: Checking for a Defined Name in a Worksheet or MacroLast reviewed: November 2, 1994Article ID: Q60120 |
SUMMARYTo check for the existence of a defined name on a Microsoft Excel worksheet or macro sheet, use the following IF() command
=IF(ISERROR(name),value_if_true,value_if_false)where "name" is the defined name, "value_if_true" is the value returned if the ISERROR() command returns TRUE, and "value_if_false" is the value returned if the ISERROR() command returns FALSE. For example, the following formula returns the text string "defined" if "MyName" is defined on the worksheet and "undefined" if "MyName" is not defined on the worksheet:
=IF(ISERROR(MyName),"undefined","defined") MORE INFORMATIONThe ISERROR(value) function returns the logical value TRUE if the value is any Excel error value (#N/A!, #VALUE!, #REF!, #DIV/0!, #NUM!, #NAME!, or #NULL!). In the above formula, if the name is defined, ISERROR() returns FALSE. Therefore, the text string "defined" is returned as the value_if_false field.
|
KBCategory: kbother
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |