0% found this document useful (0 votes)
94 views26 pages

Data Validation in Excel

The document discusses using data validation in Excel to restrict the type of data or values that users can enter into cells. It covers creating data validation rules, adding input and error messages, and provides tips for working with data validation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
94 views26 pages

Data Validation in Excel

The document discusses using data validation in Excel to restrict the type of data or values that users can enter into cells. It covers creating data validation rules, adding input and error messages, and provides tips for working with data validation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Data Validation in Excel

 
Data Validation Example | Create Data Validation Rule | Input Message | Error Alert | Data
Validation Result
Use data validation in Excel to make sure that users enter certain values into a cell.
Data Validation Example
In this example, we restrict users to enter a whole number between 0 and 10.

Create Data Validation Rule


To create the data validation rule, execute the following steps.
1. Select cell C2.

2. On the Data tab, in the Data Tools group, click Data Validation.

On the Settings tab:

3. In the Allow list, click Whole number.

4. In the Data list, click between.

5. Enter the Minimum and Maximum values.


Input Message
Input messages appear when the user selects the cell and tell the user what to enter.

On the Input Message tab:

1. Check 'Show input message when cell is selected'.

2. Enter a title.

3. Enter an input message.


Error Alert
If users ignore the input message and enter a number that is not valid, you can show them an error
alert.

On the Error Alert tab:

1. Check 'Show error alert after invalid data is entered'.

2. Enter a title.

3. Enter an error message.

4. Click OK.

Data Validation Result


1. Select cell C2.

2. Try to enter a number higher than 10.


Result:

Note: to remove data validation from a cell, select the cell, on the Data tab, in the Data Tools group,
click Data Validation, and then click Clear All. You can use Excel's Go To Special feature to quickly
select all cells with data validation.

Apply data
validation to cells
Use data validation to restrict the type of data or the
values that users enter into a cell. One of the most
common data validation uses is to create a drop-down
list.

1. Select the cell(s) you want to create a rule for.


2. Select Data >Data Validation.

       
3. On the Settings tab, under Allow, select an option:
 Whole Number - to restrict the cell to accept

only whole numbers.


 Decimal - to restrict the cell to accept only

decimal numbers.
 List - to pick data from the drop-down list.

 Date - to restrict the cell to accept only date.

 Time - to restrict the cell to accept only time.

 Text Length - to restrict the length of the text.

 Custom – for custom formula.

4.  Under Data, select a condition.


5. Set the other required values based on what you
chose for Allow and Data.
6. Select the Input Message tab and customize a
message users will see when entering data.
7. Select the Show input message when cell is
selected checkbox to display the message when the
user selects or hovers over the selected cell(s).
8. Select the Error Alert tab to customize the error
message and to choose a Style.
9. Select OK.

Now, if the user tries to enter a value that is not


valid, an Error Alert appears with your customized
message.
Want more?
More on data validation

Add or remove items from a drop-down list

Remove a drop-down list


Excel 
 
Enter and format data 
 
Data validation 
 
More on data validation

More on data
validation
Excel for Microsoft 365 Excel 2021 Excel 2019 Excel 2016 Excel
2013 Excel 2010 Excel 2007
Note: This is an advanced topic on data validation. For an introduction to data validation, and how
to validate a cell or a range, see Add data validation to a cell or a range.

You can use data validation to restrict the type of data


or values that users enter into cells. For example, you
might use data validation to calculate the maximum
allowed value in a cell based on a value elsewhere in
the workbook. In the following example, the user has
typed abc , which is not an acceptable value in that cell.
When is data validation useful?
Data validation is invaluable when you want to share a
workbook with others, and you want the data entered
to be accurate and consistent. Among other things, you
can use data validation for the following:

 Restrict entries to predefined items in a list— For


example, you can limit a user’s department
selections to Accounting, Payroll, HR, to name a few.
 Restrict numbers outside a specified range— For
example, you can specify a maximum percentage
input for an employee’s annual merit increase, let’s
say 3%, or only allow a whole number between 1 and
100.
 Restrict dates outside a certain time frame— For
example, in an employee time off request, you can
prevent someone from selecting a date before
today’s date.
 Restrict times outside a certain time frame— For
example, you can specify meeting scheduling
between 8:00 AM and 5:00 PM.
 Limit the number of text characters— For
example, you can limit the allowed text in a cell to 10
or fewer characters.
 Validate data based on formulas or values in
other cells— For example, you can use data
validation to set a maximum limit for commissions
and bonuses based on the overall projected payroll
value. If users enter more than the limit amount, they
see an error message.

Data Validation Input and


Error Messages
You can choose to show an Input Message when the
user selects the cell. Input messages are generally used
to offer users guidance about the type of data that you
want entered in the cell. This type of message appears
near the cell. You can move this message if you want
to, and it remains visible until you move to another cell
or press Esc.

You set up your Input Message in the second data


validation tab.

Once your users get used to your Input Message, you


can uncheck the Show input message when cell is
selected option.
You can also show an Error Alert that appears only
after users enter invalid data.

You can choose from three types of error alerts:

Icon Type Use to


Stop Prevent users from entering invalid
data in a cell.

A Stop alert message has two


options: Retry or Cancel.
Warning Warn users that the data they entered
is invalid, without preventing them
from entering it.

When a Warning alert message


appears, users can click Yes to accept
the invalid entry, No to edit the invalid
entry, or Cancel to remove the invalid
entry.
Information Inform users that the data they
entered is invalid, without preventing
them from entering it. This type of
error alert is the most flexible.

When an Information alert message


appears, users can click OK to accept
the invalid value or Cancel to reject it.

Tips for working with data


validation
Use these tips and tricks for working with data
validation in Excel.
Note: If you want to use data validation with workbooks in Excel Services or the Excel Web App you
will need to create the data validation in the Excel desktop version first.

 The width of the drop-down list is determined by the


width of the cell that has the data validation. You
might need to adjust the width of that cell to prevent
truncating the width of valid entries that are wider
than the width of the drop-down list.
 If you plan to protect the worksheet or workbook,
protect it after you have finished specifying any
validation settings. Make sure that you unlock any
validated cells before you protect the worksheet.
Otherwise, users will not be able to type any data in
the cells. See Protect a worksheet.
 If you plan to share the workbook, share it only after
you have finished specifying data validation and
protection settings. After you share a workbook, you
won't be able to change the validation settings
unless you stop sharing.
 You can apply data validation to cells that already
have data entered in them. However, Excel does not
automatically notify you that the existing cells
contain invalid data. In this scenario, you can
highlight invalid data by instructing Excel to circle it
on the worksheet. Once you have identified the
invalid data, you can hide the circles again. If you
correct an invalid entry, the circle disappears
automatically.

To apply the circles, select the cells you want to


evaluate and go to Data > Data Tools > Data
Validation > Circle Invalid Data.
 To quickly remove data validation for a cell, select it,
and then go to Data > Data Tools > Data
Validation > Settings > Clear All.
 To find the cells on the worksheet that have data
validation, on the Home tab, in the Editing group,
click Find & Select, and then click Data Validation.
After you have found the cells that have data
validation, you can change, copy, or remove
validation settings.
 When creating a drop-down list, you can use
the Define Name command (Formulas tab, Defined
Names group) to define a name for the range that
contains the list. After you create the list on another
worksheet, you can hide the worksheet that contains
the list and then protect the workbook so that users
won't have access to the list.
 If you change the validation settings for a cell, you
can automatically apply your changes to all other
cells that have the same settings. To do so, on
the Settings tab, select the Apply these changes to
all other cells with the same settings check box.
 If data validation isn't working, make sure that:
 Users are not copying or filling data - Data
validation is designed to show messages and prevent
invalid entries only when users type data directly in a
cell. When data is copied or filled, the messages do
not appear. To prevent users from copying and filling
data by dragging and dropping cells, go
to File > Options > Advanced > Editing
options > clear the Enable fill handle and cell
drag-and-drop check box, and then protect the
worksheet.
 Manual recalculation is turned off - If manual
recalculation is turned on, uncalculated cells can
prevent data from being validated correctly. To turn
off manual recalculation, go to the Formulas tab
> Calculation group > Calculation Options >
click Automatic.
 Formulas are error free - Make sure that formulas
in validated cells do not cause errors, such
as #REF! or #DIV/0!. Excel ignores the data validation
until you correct the error.
 Cells referenced in formulas are correct - If a
referenced cell changes so that a formula in a
validated cell calculates an invalid result, the
validation message for the cell won't appear.
 An Excel table might be linked to a SharePoint
site - You cannot add data validation to an Excel
table that is linked to a SharePoint site. To add data
validation, you must unlink the Excel table or convert
the Excel table to a range.
 You might currently be entering data - The Data
Validation command is not available while you are
entering data in a cell. To finish entering data, press
Enter or ESC to quit.
 The worksheet might be protected or shared -
You cannot change data validation settings if your
workbook is shared or protected. You’ll need to
unshare or unprotect your workbook first.

How to update or remove


data validation in an inherited
workbook
If you inherit a workbook with data validation, you can
modify or remove it unless the worksheet is protected.
If it’s protected with a password that you do not know
you should try to contact the previous owner to help
you unprotect the worksheet, as Excel has no way to
recover unknown or lost passwords. You can also copy
the data to another worksheet, and then remove the
data validation.

If you see a data validation alert when you try to enter


or change data in a cell, and you're not clear about
what you can enter, contact the owner of the
workbook.
Excel 
 
Enter and format data 
 
Data validation 
 
Add or remove items from a drop-down list
Add or remove
items from a drop-
down list
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for
the web  Excel 2021  More...

After you create a drop-down list, you might want to


add more items or delete items. In this article, we'll
show you how to do that depending on how the list
was created.
WindowsmacOSWeb

Edit a drop-down list that's based on


an Excel Table
If you set up your list source as an Excel table, then all
you need to do is add or remove items from the list,
and Excel will automatically update any associated
drop-downs for you.

 To add an item, go to the end of the list and type the


new item.
 To remove an item, press Delete.
Tip: If the item you want to delete is somewhere in the middle of your list, right-click its cell,
click Delete, and then click OK to shift the cells up.
Edit a drop-down list that’s based on a named range
Edit a drop-down list that’s based on a range of cells
Edit a drop-down list with items that have been entered manually
Working with your drop-down list

Need more help?


You can always ask an expert in the Excel Tech
Community or get support in the Answers community.
Create a drop-
down list
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for
the web More...

You can help people work more efficiently in


worksheets by using drop-down lists in cells. Drop-
downs allow people to pick an item from a list that you
create.

Want to be walked through this process? Try our new


online tutorial for drop-down lists (beta).

WindowsmacOSWeb

1. In a new worksheet, type the entries you want to


appear in your drop-down list. Ideally, you’ll have
your list items in an Excel table. If you don’t, then
you can quickly convert your list to a table by
selecting any cell in the range, and pressing Ctrl+T.

Notes: 

 Why should you put your data in a table? When your data is in a table, then as you add or
remove items from the list, any drop-downs you based on that table will automatically
update. You don't need to do anything else.
 Now is a good time to Sort data in a range or table in your drop-down list.

2. Select the cell in the worksheet where you want the


drop-down list.
3. Go to the Data tab on the Ribbon, then Data
Validation.
Note: If you can’t click Data Validation, the worksheet might be protected or shared. Unlock
specific areas of a protected workbook or stop sharing the worksheet, and then try step 3 again.

4. On the Settings tab, in the Allow box, click List.


5. Click in the Source box, then select your list range.
We put ours on a sheet called Cities, in range A2:A9.
Note that we left out the header row, because we
don't want that to be a selection option:
6. If it’s OK for people to leave the cell empty, check
the Ignore blank box.
7. Check the In-cell dropdown box.
8. Click the Input Message tab.
 If you want a message to pop up when the cell is

clicked, check the Show input message when


cell is selected box, and type a title and message
in the boxes (up to 225 characters). If you don’t
want a message to show up, clear the check box.
9. Click the Error Alert tab.
 If you want a message to pop up when someone

enters something that's not in your list, check


the Show error alert after invalid data is
entered box, pick an option from the Style box,
and type a title and message. If you don’t want a
message to show up, clear the check box.
10. Not sure which option to pick in the Style box?
 To show a message that doesn’t stop people from

entering data that isn’t in the drop-down list,


click Information or Warning. Information will
show a message with this icon   and Warning
will show a message with this icon  .
 To stop people from entering data that isn’t in the

drop-down list, click Stop.


Note: If you don't add a title or text, the title defaults to "Microsoft Excel" and the message
to: "The value you entered is not valid. A user has restricted values that can be entered into
this cell."
Remove a drop-
down list
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel for
the web Excel 2021 More...

If you no longer want a drop-down list in your


worksheet, you can remove it.
WindowsmacOSWeb

1. Select the cell with the drop-down list.

If you have multiple cells with drop-down lists that


you want to delete, you can use Ctrl+Left click to
select them.

2. Click Data >Data Validation.
3. On the Settings tab, click Clear All.
4. Click OK
If you need to remove all Data Validation from a
worksheet, including drop-down lists, but you don't
know where they are, then you can use the Go To
Special dialog. Press Ctrl+G > Special, then Data
Validation > All or Same, and repeat the steps above.

If, instead of deleting it, you decide you want to change


the options in your drop-down list, see Add or remove
items from a drop-down list.

You might also like