How to Use Variables in Excel
The Windows spreadsheet program Excel can use functions that refer to specific cell references in the same way that a formal programming uses variables. An example of using a variable in Excel would be to take the region-by-region total sales figures, put them in specific cells, and refer to those cells for additional analysis. In all cases, when using variables in Excel, the cells should be set up so they have the results you want in them.
Things You'll Need
- Excel 1995 and later
Select the cell with the result that you want to declare as a variable.
Click on the Formulas menu item, and choose Names (Excel 2003 and earlier) or Name Manager (Excel 2007 and Excel 2010).
Enter the name of the variable in the dialog that comes up. From this point on, in this workbook, you'll be able to refer to the contents of this cell by entering its name.
Tips & Warnings
- In Excel 2007 and Excel 2010, if the first few characters of a named range are entered while typing a formula, a small list of matching named ranges will show up. Use the arrow key to select one and hit the Tab key to complete the name reference.
- One particularly useful part of named variables comes with conditional formatting. Conditional formatting cannot (normally) refer to cells on other worksheets in the same workbook. It can, however, refer to a named variable.