Yes, you can lock a row in Excel to prevent other users from editing the header or summary information at the top of your data table. This is done by changing the cell protection settings and then protecting the entire worksheet. No third-party add-ins or special software are required; the native protection feature handles this for all supported versions of Excel on Windows, Mac, and Web.

What You'll Need

  • A computer with Microsoft Excel installed (desktop, Mac, or web version).
  • A spreadsheet containing data with a header row you wish to protect.
  • A computer with a mouse or trackpad (keyboard-only navigation is possible but more tedious for this specific task).

Step-by-Step

  1. Open your workbook. Launch Excel and open the specific file or worksheet where you need to lock the row. Ensure the data is loaded and visible on the screen.
  2. Identify the target row. Look at your data. The row you want to lock is usually the very first row containing titles, labels, or summary figures. For example, if row 1 contains "Product Name," "Category," and "Price," you want to lock row 1.
  3. Highlight the target cells. Click on the top-left cell of the row you want to lock. Drag your mouse across the row to the right to highlight all the cells in that specific row. Alternatively, you can highlight the entire column headers if your data spans multiple columns. It is important to select every single cell in that row that contains data or labels you want to protect.
  4. Access the Format Cells menu. Right-click on any of the highlighted cells. In the context menu that appears, select Format Cells.... This will open a dialog box with multiple tabs at the top.
  5. Navigate to the Protection tab. Inside the Format Cells dialog box, look at the list of tabs along the top. Click on the tab labeled Protection. This tab contains the settings for whether a cell can be locked or not.
  6. Uncheck the "Locked" option. By default, every cell in an Excel worksheet is locked. To allow editing for the cells you do not want to protect, you must manually change this setting. On the Protection tab, uncheck the box next to Locked. This tells Excel that this specific cell (and all others in the selection) can be changed by users.
  7. Deselect the cells. Click anywhere on the empty white space of your worksheet to deselect the cells you just formatted. This step is crucial because Excel applies protection settings to the *selected* cells. If you leave them selected, the next step might apply protection to the wrong area.
  8. Select the cells to be locked. Now, go back and select the cells in the row you want to lock. This is the row you do not want users to change. Highlight every cell in that row. Note that you do not need to select the whole row if you only want to protect specific cells within it; you can simply select those specific cells.
  9. Lock the selected cells. With these new cells selected, right-click and choose Format Cells... again. Navigate to the Protection tab. Check the box next to Locked. This tells Excel that these cells are off-limits when the worksheet is protected.
  10. Open the Protect Sheet dialog. Go to the main Excel ribbon at the top of the window. Click on the Review tab. In the center of the ribbon, you will see a button labeled Protect Sheet. Click this button.
  11. Set a password (optional). The Protect Sheet dialog box will open. There is a field at the top labeled Password to unprotect sheet. You have the option to enter a password here. If you leave this field empty, anyone can click "Unprotect Sheet" on the Review tab and edit the data immediately. If you enter a password, you must remember it, or you will be locked out of your own file. To proceed without a password, you can simply leave the field blank.
  12. Configure protection options. Below the password field, you will see a list of permissions. These options control what users can do even with a locked sheet. The key options for locking a row are:
    • Select unlocked cells: This must be checked. It allows users to click and select cells that are not locked. If this is unchecked, users cannot even select the data they want to edit, making the spreadsheet unusable.
    • Format cells: It is usually best to uncheck this. If a user can format cells, they can often work around the lock to change the content.
    • Insert columns/rows: Uncheck these if you do not want users to alter the structure of your table.
  13. Confirm protection. Click the OK button at the bottom of the dialog box. The sheet is now protected. When you try to click on a cell in the locked row, you will see the cell selection box move, but the cell will not enter "edit mode" (where you can type). You cannot change the values in the locked row.
  14. Unlock the sheet (to make edits). When you need to update the locked row, you must first unlock it. Go back to the Review tab and click the Unprotect Sheet button. If you set a password, you will be prompted to enter it. Once unprotected, you can edit the cells in the locked row. Remember to lock it again by repeating step 10 after you are done.

Common Mistakes

The most frequent error users make is failing to deselect the cells after modifying the protection settings. If you select the cells you want to be unlocked and leave them selected while clicking "Protect Sheet," Excel applies the protection to the *selected* cells, effectively locking every cell in the range. Always deselect before selecting the opposite set of cells.

Another mistake is confusing the protection settings with the visibility of cells. Locking a row does not hide it or make it read-only in the sense that you cannot see it. It simply prevents you or others from changing the data inside those cells. If you need to hide data entirely, you must use the Hide feature on the Format Cells menu, which is separate from the Lock feature.

Tips

For large tables, clicking through every cell in a row can be tedious. A faster way is to use the row number indicator on the left side of the Excel window. Click the small box at the very top-left corner of the grid (where the row and column numbers meet) to select the entire table. Then, right-click the row number of the header row you want to lock and choose Format Cells. This method is much faster for selecting the entire row at once.

When protecting a sheet, consider using a very complex password or a password manager to generate one. Simple passwords are easy to guess, especially if multiple people have access to the file. However, keep in mind that if you forget a password, Microsoft does not provide a way to recover it. The file will be permanently locked until the password is remembered.

Troubleshooting

Problem: I cannot select the cells in the locked row.

This usually happens because the "Select unlocked cells" option is unchecked in the Protect Sheet dialog box. Go to the Review tab and click Unprotect Sheet. Then, re-open the Protect Sheet dialog and ensure the box next to "Select unlocked cells" is checked. Click OK to save the changes.

Problem: I protected the sheet, but the data is still changing.

Check the protection options in the Protect Sheet dialog box. If the "Format cells" option is checked, users can change the font, color, and size of text. This does not change the data, but it can be confusing. More importantly, ensure that you actually unlocked the cells you wanted to edit. If you left the cells locked, they will not change. Double-check that you deselected the cells before protecting the sheet.

Problem: I forgot the password.

If you entered a password and have forgotten it, there is no built-in feature to recover it. You must create a new copy of the workbook and manually re-enter the data. There are third-party password recovery tools available online, but they are often unreliable and can cost money. It is best to create a new file and start fresh if you cannot remember the password.

Problem: The protection settings are not applying to the whole row.

Ensure that you are formatting the cells, not the row. Right-clicking the row number and choosing "Format Cells" only works if the cells are already selected. If you just right-click the row number without selecting the cells first, Excel will not open the Format Cells dialog box. You must click the cells first, then right-click.

Frequently Asked Questions

Can I lock multiple rows at once?

Yes, you can. Simply select all the cells in the multiple rows you want to lock. For example, if you want to lock rows 1 and 2, click on cell A1, drag your mouse down to cell B2, and then right-click to Format Cells. Uncheck the Locked option for this selection to allow editing, deselect, then select the specific cells in rows 1 and 2 again and check the Locked option before protecting the sheet.

Does locking a row prevent me from sorting the data?

No. Protection only stops users from changing the values in specific cells. Users can still select the entire table and sort it using the Sort buttons on the Data tab. If you want to prevent sorting, you must also uncheck the "Sort" option in the Protect Sheet dialog box.

What is the difference between "Hidden" and "Locked"?

Locked prevents editing the cell's contents. Hidden prevents the cell's contents from being visible in the formula bar if the cell is selected. You can use both settings together, but they serve different purposes. A locked cell might be visible, while a hidden cell will show a blank space in the formula bar even if it contains data.

Can I lock a row on a mobile device?

The basic protection feature is available on the Excel mobile app for iOS and Android. The steps are largely the same: select the cells, tap Format Cells, go to the Protection tab, and uncheck Locked. Then, go to the Review tab and tap Protect Sheet. However, some of the specific protection options in the dialog box may vary slightly depending on the mobile version of the app.

Will locking a row prevent me from adding new data below it?

No. Locking a row only affects the cells within that specific row. You can still insert new rows below the locked row, and the locked row will remain at the top of your data. The new rows will be unlocked by default, allowing you to enter data into them.

Can I lock just one column instead of a row?

Absolutely. The process is identical. You select the cells in the column you want to lock (e.g., column A), right-click to Format Cells, and toggle the Locked option. Then, you protect the sheet. The logic is the same: select the cells you want to edit, uncheck Locked, deselect, select the cells you want to protect, check Locked, and then protect the sheet.