Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Excel Tutorial
  • Excel Formulas
  • Excel Shortcut Keys
  • Data Analysis in Excel
  • Formatting in Excel
  • Excel Workbooks
  • Statistical Functions
  • Data Visualization in Excel
  • Pivot Tables in Excel
  • MS Excel Quiz
  • Excel Interview Questions
  • Advance Excel
Open In App
Next Article:
How to Lock Cells In Excel: A Complete Guide
Next article icon

How to Lock Cells In Excel: A Complete Guide

Last Updated : 05 Feb, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

How to Protect Cells in Excel Spreadsheet- Quick Steps

  • Select the cells you want to protect.
  • Right-click, choose Format Cells>>Go to the Protection tab>> check Locked.
  • Go to the Review tab>> click Protect Sheet >> set a password (optional) >>click OK.

Locking cells in Excel or Protecting Cells in Spreadsheet is essential for protecting your data from unintended edits, especially in shared or collaborative workbooks. When you lock cells, you can prevent changes to specific parts of a worksheet, ensuring that formulas, values, and structure remain intact.

This complete guide covers everything you need to know about locking cells in Excel. From locking specific cells or formulas to protecting entire worksheets, we’ll walk you through step-by-step instructions. You’ll also learn how to lock cells without protecting the entire sheet, unlock cells when needed, and even freeze rows and columns for easier navigation.

Lock Cells In Excel

Why Lock Cells in Excel

Locking cells in Excel is helpful when you want to:

  • Protect formulas from accidental changes.
  • Limit access to specific areas in a shared workbook.
  • Ensure that certain values and structures remain consistent and untouched.
  • Allow only authorized users to edit specific cells.

How to Lock Specific Cells in Excel

If you want to protect specific cells but allow edits to others, follow these steps:

Step 1: Select the Cells to Lock

Highlight the cells or range of cells you want to lock. 

Lock Cells In Excel
Select Cells or Range of Cells

Step 2: Right Click and Select Format Cells

Right-click the selected cells and choose Format Cells, or press Ctrl + 1 to open the Format Cells dialog box.

Lock Cells In Excel
Right Click and then Click Format Cells

Step 3: Enable the Locked Option

  • In the Format Cells dialog, go to the Protection tab and check the Locked option.
  • Click OK to apply the changes.
Lock Cells In Excel
Enable the Locked Option and Click OK

Step 4: Protect the Worksheet

  • Go to the Review tab in the Excel Ribbon.
  • Click Protect Sheet
  • If desired, enter a password to prevent unauthorized users from unprotecting the sheet.
  • Click OK to apply the protection.
Lock Cells In Excel
Go to Review Tab >> Click on Protect Sheet>> Set the Password >>Press OK

Step 5: Preview the Results

Excel will display a warning, as shown in the image below, if you attempt to make any changes to locked cells.

Lock Cells In Excel
Cells Locked

How to Lock All Cells in Excel

To lock all cells in an Excel worksheet, follow these steps:

Step 1: Select All Cells

Press Ctrl + A to select the entire worksheet.

Step 2: Open the Format Cells Dialog

Right-click on any selected cell and choose Format Cells.

Lock Cells In Excel
Click on Format Cells

Step 3: Enable the Locked Option

  • Go to the Protection tab in the Format Cells dialog.
  • Make sure the Locked checkbox is checked and click OK.
Lock Cells In Excel
Click on Protection Tab

Step 4: Protect the Sheet

  • Go to the Review tab and click Protect Sheet.
Lock Cells In Excel
Go to Review Tab>> Click on Protect Sheet>>Set the Password >> Press OK

Step 5: Preview Results

Excel will show a warning alert if you attempt to edit the data in locked cells.

Lock Cells In Excel
Warning Alert

How to Protect a Worksheet in Excel

Protecting a worksheet in Excel not only locks cells but also ensures that your entire sheet (or specific parts of it) is safeguarded from unwanted changes. Here’s how you can protect a worksheet step by step:

Step 1: Go to the Review Tab

Navigate to the Review tab in the Excel toolbar (or press Alt + R)

Step 2: Click on "Protect Sheet"

In the Review tab, click Protect Sheet. A dialog box will appear.

Alternatively Press the Shortcut (Alt + R + P + S)

Lock Cells In Excel
Go to review tab>>Click on Protect Sheet

Step 3: Set a Password (Optional)

Enter a password if you want to restrict access to the protection settings. Make sure to remember this password, as it will be required to unprotect the sheet.

Lock Cells In Excel
Choose Password

Step 4: Choose the Protection Options

Select which actions users can perform, such as:

  • Selecting locked or unlocked cells
  • Formatting cells
  • Inserting rows or columns
  • Deleting columns or rows

Step 5: Click OK

Confirm your settings by clicking OK.

Your worksheet is now protected, meaning any locked cells cannot be edited unless the sheet is unprotected. This is a great way to ensure the integrity of your data, especially when sharing your spreadsheet with others.

Tip: If you need to make changes later, you can unprotect the sheet by returning to the Review tab and clicking Unprotect Sheet. Enter the password if prompted.

How to Lock Formulas in Excel

To protect only the cells containing formulas while allowing other cells to remain editable, follow these steps:

Disclaimer: Always Unlock Non-Formula Cells First!

Before protecting the sheet, make sure to unlock non-formula cells if you want them to remain editable. Select those cells, go to Format Cells → Protection, and uncheck "Locked".

Step 1: Select All Cells

  • Press Ctrl + A to select the entire worksheet.
Lock Cells In Excel
Select All Cells

Step 2: Unlock All Cells

  • Right-click the selected cells and choose Format Cells (Ctrl + 1).
  • In the Protection tab, uncheck the Locked box.
  • Click OK to apply the changes.
Lock Cells In Excel
Right-Click >> Select Format Cells>>Click Locked Cells

Step 3: Select Formula Cells

  • Go to the Home tab, click Find & Select, and choose Go To Special (Or Press Ctrl + G).
  • Select Formulas and click OK to highlight all the cells that contain formulas.
Lock Cells In Excel
Go to Home Tab>>> Click on Find & Select >>Select Go to Special>> Select Formulas>>Click ok

Step 4: Lock Formula Cells

  • Right-click the selected formula cells and choose Format Cells ( Or Press Ctrl + 1)
  • In the Protection tab, check the Locked box and click OK.
Lock Cells In Excel
Select the Formula Cells>> Select "Format Cells">> Click on Protection Tab>> Click on Locked >> Press OK

Step 5: Protect the Sheet

  • Go to the Review tab and click Protect Sheet.
  • Optionally, set a password to restrict changes.
  • Click OK to apply the protection.

(Alternatively, Press the Shortcut Alt + R + P + S)

Lock Cells In Excel
Go to Review Tab >>Click on Protect Sheet>>Set the Password >>Click ok

Result: The formula cells are now locked and cannot be edited, while other cells in the worksheet remain editable.

Lock Cells Without Protecting the Entire Sheet

If you want to restrict cell editing in Excel without locking the whole sheet, you can lock specific cells while leaving others editable. Here's how to do it:

Step 1: Select the Cells You Want to Protect

Highlight the cells you wish to lock.

Lock Cells In Excel
Highlight the Cells

Step 2: Open the Format Cells Dialog

Right-click the selected cells and choose Format Cells (or use the shortcut Ctrl + 1)

Lock Cells In Excel
Right Click and Select Format Cells

Step 3: Enable the Locked Option

In the Protection tab, ensure the Locked checkbox is checked.

Lock Cells In Excel
Enable the Locked Option

Step 4: Allow Edit Ranges

Go to the Review tab and click Allow Edit Ranges.

Alternatively Use the Shortcut (Alt + R + R).

Step 5: Define the Range

In the Allow Users to Edit Ranges dialog box, click New to define the range of cells you want to lock.

Lock Cells In Excel
Allow Edit Range>> Define the Range

How to Unlock Cell Lock in Excel

By default, all cells are locked for editing in a spreadsheet, but it has no effect until you protect the worksheet. If you need to remove the lock from previously locked cells:

Step 1: Select All Cells

Press "Ctrl+A" on your keyboard to select all cells. (To select a whole range of sheets).

Lock Cells In Excel
Select All Cells

Step 2: Select Format cells

Right-click on the selected cells and select the FormatCells option from the dropdown.
 

Lock Cells In Excel

Step 3: Choose the Protection Tab and Uncheck the Locked

A prompt box will open on your screen under the Protection tab uncheck the Locked option. (Alternatively, you can press Ctrl+1). Click on the OK button.
Lock Cells In Excel

How to Freeze Cells, Rows, and Columns in Excel

Freezing panes helps keep headers or specific rows and columns visible while scrolling through large datasets. Follow these steps to freeze cells, rows, or columns in Excel:

Step 1: Select the Cell, Row, or Column to Freeze

  • To freeze a row: Select the row below the one you want to keep visible.
  • To freeze a column: Select the column to the right of the one you want to keep visible.
  • To freeze both rows and columns: Click on the cell below the row and to the right of the column you want to freeze.

Step 2: Open the View Tab

  • Go to the View tab in the Excel ribbon.

Step 3: Apply the Freeze Panes Option

  • Click on Freeze Panes in the Window group.
  • Choose one of the following options:
    • Freeze Panes: Locks selected rows and columns.
    • Freeze Top Row: Locks the first row of the sheet.
    • Freeze First Column: Locks the first column of the sheet.

Tips and Best Practices for Cell Lock in Excel Spreadsheet

  • Prevent selection of locked cells: While protecting the sheet, uncheck "Select locked cells."
  • Add a Lock Cell button: To the Quick Access Toolbar for easier access.
  • Use different formatting: For locked cells to distinguish them from editable cells.
  • Set a password: To further secure the protected sheet.

These tips not only show how to protect some cells in Excel but also how to protect selected cells in Excel for better data management.

Conclusion

Locking cells in Excel is a must-know skill for anyone sharing or collaborating on spreadsheets. By following this guide, you’ve learned how to lock specific cells, protect entire worksheets, and even lock formulas to prevent accidental changes. You’ve also discovered how to unlock cells when necessary and freeze rows or columns for better visibility.

Now that you know how to lock cells in Excel, you can confidently share your work without worrying about unwanted edits.


Next Article
How to Lock Cells In Excel: A Complete Guide

P

parthmadan3739
Improve
Article Tags :
  • Excel
  • Excel-basics
  • ExcelGuide

Similar Reads

    How to Lock Cells in Google Sheets : Step by Step Guide
    Have you ever shared a Google Sheet, only to discover that important data or formulas were accidentally changed? Learning how to lock cells in Google Sheets from editing is essential for maintaining the accuracy and security of your data. Whether you’re looking to protect crucial formulas, set restr
    7 min read
    How to Create a Form in Excel - A Step by Step Guide
    Creating forms in Excel is an efficient way to capture and organize data, whether you’re tracking inventory, collecting survey responses, or entering client information. Excel forms are customizable and easy to use, making data entry faster and more organized, especially when handling large datasets
    7 min read
    How to Add a Column in Excel: Step-by-Step Guide
    Need to organize your data better in Excel but unsure how to add a column without disrupting your existing setup? Whether you’re working with a simple list or a complex table, inserting columns is a fundamental skill that increases productivity and keeps your data structured.This guide covers 4 easy
    6 min read
    How to Lock Formulas in Excel
    Are you tired of accidentally altering formulas in your Excel spreadsheets? Locking formulas in Excel is essential for maintaining the integrity of your data and ensuring that your calculations remain accurate. In this comprehensive article, you will learn the effective techniques to protect your Ex
    8 min read
    How to Password Protect a Google Sheet: A Complete Guide
    Google Sheets is a popular tool used for collaboration, but sometimes you need to keep certain data secure. Password protecting a Google Sheet ensures that only authorized individuals have access to sensitive information. Although Google Sheets doesn’t offer a direct password protection feature, the
    7 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences