Excel: SET.VALUE, SET.NAME, and DEFINE.NAME Differences

Last reviewed: November 2, 1994
Article ID: Q26066

SUMMARY

The following is a description of the differences among the Microsoft Excel macro functions SET.NAME, SET.VALUE, and DEFINE.NAME.

MORE INFORMATION

SET.VALUE is a macro control function that places specific value(s) directly into cell(s) on the macro sheet, whether the macro sheet is active or not. For example, the formula =SET.VALUE(C2,34.7) on a macro sheet titled "Macro1" will enter 34.7 into cell C2 on the "Macro1" macro sheet.

SET.NAME is a macro control function that defines a variable name to be associated with a certain value on the macro sheet. The variable name can then be used in other macro statements to represent this value. For example, the following set of macro steps sets the value 2 to be associated with the name "test":

   =SET.NAME("test",2)
   =FORMULA(test)

This value is then placed into the active cell on the active worksheet. The macro sheet does not have to be active to use SET.NAME.

DEFINE.NAME is a command-equivalent macro function that attaches a name to a cell category, value, or formula on the active worksheet or macro sheet. This name can then be used in place of the cell category or other value. For example, the following macro steps associate the name "answer" with cell $B$2 on the active worksheet and then place a formula, which divides this value by 100, into the active cell:

   =DEFINE.NAME("answer",!$B$2)
   =FORMULA("=answer/100")

The difference between SET.NAME and DEFINE.NAME is that SET.NAME can only define names on a macro sheet, and DEFINE.NAME always defines a name on the active window, whether the active window is a worksheet or macro sheet.

For more information regarding SET.NAME, DEFINE.NAME, and SET.VALUE, see pages 48-49, 217-218, and 220-221 in the "Microsoft Excel Function Reference" version 3.0 manual. If you are using Excel 2.20, see pages 209-210, 279-280, and 281 in the "Microsoft Excel Functions and Macros" version 2.2 manual.


KBCategory: kbother
KBSubcategory:

Additional reference words: 1.00 1.03 1.04 1.06 1.50 2.20 3.00


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.