What assigning a variable in Excel actually means
Excel does not have variables in the way programming languages do. Instead, you create a named range — a label you give to a cell or group of cells so you can refer to it by name instead of its cell address. When you type a formula, you can write =SUM(Sales) instead of =SUM(A2:A50). The name stays the same even if you move or copy the cells, and it makes your formulas easier to read and maintain.
Named ranges work in Excel for Windows, Excel for Mac, and Excel Online. Google Sheets calls them "named ranges" too and works almost identically. The process takes about 30 seconds once you know where to look.
Key Takeaways
- A named range is a label you assign to one cell or a group of cells, letting you use that name in formulas instead of the cell address.
- You create a named range by selecting the cells, then typing the name into the Name Box (the field to the left of the formula bar) and pressing Enter.
- Named ranges make formulas readable and protect them from breaking if you insert or delete rows and columns.
- You can manage all your named ranges in one place using the Name Manager, accessible from the Formulas tab or by pressing Ctrl+F3 on Windows or Cmd+Shift+F3 on Mac.
Creating a named range using the Name Box
The fastest way to create a named range is through the Name Box, the white field on the left side of the formula bar that normally shows the cell address (like "A1" or "B5:B20"). Select the cell or cells you want to name, click in the Name Box, type the name you want, and press Enter. That is the entire process.
Names must start with a letter or underscore, can contain letters and numbers, and cannot contain spaces. Use underscores or capital letters to separate words: Monthly_Sales or MonthlyRevenue both work. Avoid names that look like cell addresses (like "A1" or "Z99") because Excel will get confused. Names are not case-sensitive, so Sales and SALES refer to the same range.
Once you create the name, you can use it anywhere in your workbook. Type it into a formula, and Excel will recognize it. If you hover over a cell that contains a named range, Excel shows you the name in a small tooltip.
Creating a named range from the Formulas menu
If you prefer a dialog box, you can create a named range through the Formulas tab. Select your cells, then click the Formulas tab at the top, find the "Define Name" button (in Windows) or "Define Name" option (on Mac), and a dialog opens. Type your name and click OK. This method gives you more options, including the ability to add a comment describing what the range contains.
The Formulas menu also shows you a "Name Manager" button. Click it to see all the named ranges in your workbook, edit them, or delete ones you no longer need. This is useful if you have created many names and want to keep track of what exists.
Using named ranges in formulas
Once you have created a named range, use it in any formula the same way you would use a cell address. If you named cells A2:A50 as Sales, you can write =SUM(Sales) instead of =SUM(A2:A50). If you named cell B1 as TaxRate, you can write =A1*TaxRate to multiply the value in A1 by whatever is in B1.
When you start typing a formula and begin typing a name you have created, Excel shows you a dropdown list of matching names. Click the name to insert it, or keep typing and press Tab to accept it. This autocomplete feature helps you avoid typos and reminds you which names exist.
Named ranges also work across sheets. If you name a range on Sheet1 and want to use it on Sheet2, you can — just type the name into your formula as usual. Excel knows to look on Sheet1 for it.
Why named ranges protect your formulas
If you use cell addresses in your formulas and then insert a new row or column, the cell addresses shift and your formula may break or point to the wrong cells. Named ranges do not have this problem. If you name cells A2:A50 as Sales and then insert a row above them, the named range automatically expands to include the new row. Your formulas keep working without any change from you.
This protection is especially valuable in shared workbooks or templates that other people use. A formula written as =SUM(Sales) is much less likely to break than one written as =SUM(A2:A50), and it is also much easier for someone else to understand what the formula does.
Naming ranges that change size automatically
You can create a named range that grows or shrinks automatically as you add or remove data. This uses a formula-based definition rather than a fixed cell address. In the Name Manager, instead of selecting cells, you type a formula like =OFFSET(Sheet1.$A$1,0,0,COUNTA(Sheet1.$A:$A),1). This creates a range that starts at A1 and expands down as far as there is data in column A.
This technique is advanced and not necessary for most users. If you find yourself adding data to a range regularly and want your formulas to include it automatically, this is the solution — but it requires understanding how OFFSET and COUNTA work. For most everyday use, a simple named range is enough.
Frequently Asked Questions
Can I name a range that spans multiple sheets?
No. A named range must be on a single sheet. You can create separate named ranges on different sheets with the same name, and Excel will know which one you mean based on context, but a single name cannot point to cells on two different sheets at once.
What happens to a named range if I delete the cells?
The named range still exists, but it points to a deleted range and formulas using it will show a #REF! error. You should delete the named range from the Name Manager if you no longer need it. The Name Manager will show you which names have broken references so you can clean them up.
Can I use a named range in a chart?
Yes. When you create a chart, you can reference named ranges in the data series instead of cell addresses. This makes charts more portable — if you move the data, the chart updates automatically because it is looking for the named range, not a specific address.
How do I see all the named ranges in my workbook?
Open the Name Manager by clicking the Formulas tab and selecting "Name Manager", or press Ctrl+F3 on Windows or Cmd+Shift+F3 on Mac. The Name Manager shows every named range, what cells it refers to, and whether it is scoped to the whole workbook or a single sheet.
Can I rename a named range after I create it?
Yes. Open the Name Manager, click the name you want to change, type the new name in the field at the top, and click "Add". Then delete the old name. All formulas using the old name will automatically update to use the new name.