How to Anchor a Row in Excel (Lock Rows)
In this article
To anchor a row in Excel (keep it from shifting when you copy a formula), add a dollar sign before the row number in the cell reference, like $A$1 for both column and row, or A$1 to lock only the row. You can type the dollar signs manually or press F4 after clicking the reference to cycle through the four reference types. This locks the row part of the reference so it stays fixed when you fill down or copy across. The steps below cover manual typing, the F4 shortcut, and how to anchor multiple rows at once.
What You'll Need
- Excel for Windows, Mac, or Excel for the web (the F4 shortcut works on desktop; on the web you type the dollar signs manually).
- A worksheet with at least one formula that references another cell.
- Basic familiarity with entering formulas (starting with =).
Step-by-Step
- Open your workbook and click the cell where you want the formula. For example, click cell B2 if you want to calculate a value based on a row header in A2 and a column header in B1.
- Start typing the formula with an equals sign, then enter the function or operation. For example, type
=A2*B1. - Decide which part to anchor. If you want the row to stay fixed when you copy the formula down, anchor the row number. If you also want the column fixed, anchor both. The dollar sign goes before the part you want to lock:
$A$1locks column A and row 1;A$1locks only row 1;$A1locks only column A. - Type the dollar signs manually by placing your cursor in the reference and typing
$before the row number (and before the column letter if needed). For example, changeA1toA$1. - Or use the F4 shortcut: after typing the cell reference (e.g.,
A1), press F4 on Windows or Cmd+T on Mac. Each press cycles through:A1→$A$1→A$1→$A1→ back toA1. Stop when you see the combination you need (for row anchoring,A$1). - Press Enter to confirm the formula. The cell now contains the anchored reference.
- Copy the formula to other cells by dragging the fill handle (the small square at the bottom-right of the cell) or using Ctrl+C and Ctrl+V. The anchored row will remain fixed; the unanchored parts will adjust relative to each new location.
- Verify the result by clicking a copied cell and checking the formula bar. The anchored reference should still show the dollar sign before the row number.
Labels and shortcuts can differ slightly by Excel version, device, or region. On Excel for the web, the F4 shortcut is not available; type the dollar signs manually. On Mac, the shortcut is Cmd+T rather than F4.
Common Mistakes
- Anchoring the wrong part. Putting the dollar sign before the column letter (
$A1) locks the column, not the row. To lock the row, the dollar sign must go before the row number (A$1). - Forgetting to anchor before copying. If you copy first and then try to add dollar signs, you will have to edit each copied formula individually. Anchor the original before filling.
- Using F4 on a Mac without the Fn key. On some Mac keyboards, F4 may require pressing Fn+F4, or you may need to use Cmd+T instead. Check your keyboard settings.
- Anchoring a whole row reference incorrectly. If you want to anchor an entire row (e.g.,
1:1), you cannot use dollar signs in the same way; instead, use absolute references like$1:$1in functions that accept range references, or restructure the formula. - Assuming anchoring works across sheets. Anchoring only affects how references change when copied within the same sheet or to other sheets; it does not prevent a reference from pointing to a different sheet if you copy across sheets without adjusting the sheet name.
Tips
- Use F4 to cycle through reference types quickly; it is faster than typing dollar signs.
- To anchor multiple rows at once, select the range of cells containing formulas, then use Find & Replace (Ctrl+H) to replace relative references with absolute ones. For example, find
A1and replace withA$1. Be careful to match only the references you intend to change. - When building a formula that will be copied down a column but always refer to a header row, anchor the row of the header (e.g.,
B$1) and leave the column relative. - Use named ranges as an alternative to anchoring: define a name for a cell or range, then use that name in formulas. Named ranges are always absolute by default.
- Press Ctrl+` (grave accent) to toggle showing formulas in cells, making it easier to spot missing dollar signs.
Troubleshooting
- The formula still changes when copied. Double-check that the dollar sign is in the correct position. For row anchoring, it must be before the row number, e.g.,
A$1. If you used$A$1, both row and column are locked, which may be more than you need. - F4 does nothing. Ensure you are editing the cell (cursor inside the formula) and that the reference is selected. On laptops, you may need to press Fn+F4. On Mac, try Cmd+T. In Excel for the web, type the dollar signs manually.
- Anchored reference points to the wrong cell after inserting rows. Anchoring does not prevent Excel from adjusting references when you insert or delete rows above the anchored cell. If you insert a row above row 1, the reference may shift. To avoid this, use structured references (in Excel Tables) or named ranges.
- You need to anchor a row in a chart or conditional formatting rule. The same dollar-sign logic applies in formulas used for those features. Edit the rule or series formula and add the dollar sign before the row number.
- Copying across sheets changes the sheet name. Anchoring only locks the cell reference, not the sheet name. If you copy a formula to another sheet, Excel may adjust the sheet reference. To keep the sheet fixed, include the sheet name with dollar signs, e.g.,
Sheet1!$A$1.
Frequently Asked Questions
What does it mean to anchor a row in Excel?
Anchoring a row means making the row part of a cell reference absolute so it does not change when you copy the formula to other cells. You do this by adding a dollar sign before the row number, like A$1.
How do I anchor a row without typing dollar signs?
After typing the cell reference in the formula, press F4 (Windows) or Cmd+T (Mac) to cycle through reference types until the row is locked. On Excel for the web, you must type the dollar signs manually.
Can I anchor multiple rows at once?
Yes. Select the cells with formulas, then use Find & Replace (Ctrl+H) to replace relative references with absolute ones. For example, replace A1 with A$1. Be careful to match only the references you want to change.
Why does my anchored row still change when I insert rows?
Anchoring prevents changes when copying formulas, but Excel may adjust references when you insert or delete rows above the anchored cell. To avoid this, use Excel Tables with structured references or named ranges.
Does anchoring work in Excel for the web?
Yes, the dollar-sign syntax works the same way, but the F4 shortcut is not available. You need to type the dollar signs manually.
What is the difference between $A$1 and A$1?
$A$1 locks both the column and the row, so the reference never changes when copied. A$1 locks only the row, so the column can change but the row stays fixed.