Adding validation in excel

Use data validation to restrict the type of data or the values that users enter into a cell, like a dropdown list.

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Try it!

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

  2. Select Data >Data Validation.

           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.

Download our examples

Download an example workbook with all data validation examples in this article

If you’re creating a sheet that requires users to enter data, you might want to restrict entry to a certain range of dates or numbers, or make sure that only positive whole numbers are entered. Excel can restrict data entry to certain cells by using data validation, prompt users to enter valid data when a cell is selected, and display an error message when a user enters invalid data.

Restrict data entry

  1. Select the cells where you want to restrict data entry.

  2. On the Data tab, click Data Validation > Data Validation.

    Note: If the validation command is unavailable, the sheet might be protected or the workbook might be shared. You cannot change data validation settings if your workbook is shared or your sheet is protected. For more information about workbook protection, see Protect a workbook.

  3. In the Allow box, select the type of data you want to allow, and fill in the limiting criteria and values.

    Note: The boxes where you enter limiting values will be labeled based on the data and limiting criteria that you have chosen. For example, if you choose Date as your data type, you will be able to enter limiting values in minimum and maximum value boxes labeled Start Date and End Date.

Prompt users for valid entries

When users click in a cell that has data entry requirements, you can display a message that explains what data is valid.

  1. Select the cells where you want to prompt users for valid data entries.

  2. On the Data tab, click Data Validation > Data Validation.

    Note: If the validation command is unavailable, the sheet might be protected or the workbook might be shared. You cannot change data validation settings if your workbook is shared or your sheet is protected. For more information about workbook protection, see Protect a workbook.

  3. On the Input Message tab, select the Show input message when cell is selected check box.

  4. In the Title box, type a title for your message.

  5. In the Input message box, type the message that you want to display.

Display an error message when invalid data is entered

If you have data restrictions in place and a user enters invalid data into a cell, you can display a message that explains the error.

  1. Select the cells where you want to display your error message.

  2. On the Data tab, click Data Validation > Data Validation.

    Note: If the validation command is unavailable, the sheet might be protected or the workbook might be shared. You cannot change data validation settings if your workbook is shared or your sheet is protected. For more information about workbook protection, see Protect a workbook.

  3. On the Error Alert tab, in the Title box, type a title for your message.

  4. In the Error message box, type the message that you want to display if invalid data is entered.

  5. Do one of the following:

    To

    On the
    Style
    pop-up menu, select

    Require users to fix the error before proceeding

    Stop

    Warn users that data is invalid, and require them to select Yes or No to indicate if they want to continue

    Warning

    Warn users that data is invalid, but allow them to proceed after dismissing the warning message

    Important

Add data validation to a cell or a range

Note: The first two steps in this section are for adding any type of data validation. Steps 3-7 are specifically for creating a drop-down list. 

  1. Select one or more cells to validate.

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

  3. On the Settings tab, in the Allow box, select List.

  4. In the Source box, type your list values, separated by commas. For example, type Low,Average,High.

  5. Make sure that the In-cell dropdown check box is selected. Otherwise, you won’t be able to see the drop-down arrow next to the cell.

  6. To specify how you want to handle blank (null) values, select or clear the Ignore blank check box.

  7. Test the data validation to make sure that it is working correctly. Try entering both valid and invalid data in the cells to make sure that your settings are working as you intended and your messages are appearing when you expect.

Notes: 

  • After you create your drop-down list, make sure it works the way you want. For example, you might want to check to see if the cell is wide enough to show all your entries.

  • Remove data validation — Select the cell or cells that contain the validation you want to delete, then go to Data > Data Validation and in the data validation dialog press the Clear All button, then click OK.

The following table lists other types of data validation and shows you ways to add it to your worksheets.

To do this:

Follow these steps:

Restrict data entry to whole numbers within limits.

  1. Follow steps 1-2 above.

  2. From the Allow list, select Whole number.

  3. In the Data box, select the type of restriction that you want. For example, to set upper and lower limits, select between.

  4. Enter the minimum, maximum, or specific value to allow.

    You can also enter a formula that returns a number value.

    For example, say you’re validating data in cell F1. To set a minimum limit of deductions to two times the number of children in that cell, select greater than or equal to in the Data box and enter the formula, =2*F1, in the Minimum box.

Restrict data entry to a decimal number within limits.

  1. Follow steps 1-2 above.

  2. In the Allow box, select Decimal.

  3. In the Data box, select the type of restriction that you want. For example, to set upper and lower limits, select between.

  4. Enter the minimum, maximum, or specific value to allow.

    You can also enter a formula that returns a number value. For example, to set a maximum limit for commissions and bonuses of 6% of a salesperson’s salary in cell E1, select less than or equal to in the Data box and enter the formula, =E1*6%, in the Maximum box.

    Note: To let a user enter percentages, for example 20%, select Decimal in the Allow box, select the type of restriction that you want in the Data box, enter the minimum, maximum, or specific value as a decimal, for example .2, and then display the data validation cell as a percentage by selecting the cell and clicking Percent Style Button image in the Number group on the Home tab.

Restrict data entry to a date within range of dates.

  1. Follow steps 1-2 above.

  2. In the Allow box, select Date.

  3. In the Data box, select the type of restriction that you want. For example, to allow dates after a certain day, select greater than.

  4. Enter the start, end, or specific date to allow.

    You can also enter a formula that returns a date. For example, to set a time frame between today’s date and 3 days from today’s date, select between in the Data box, enter =TODAY() in the Start date box, and enter =TODAY()+3 in the End date box.

Restrict data entry to a time within a time frame.

  1. Follow steps 1-2 above.

  2. In the Allow box, select Time.

  3. In the Data box, select the type of restriction that you want. For example, to allow times before a certain time of day, select less than.

  4. Enter the start, end, or specific time to allow. If you want to enter specific times, use the hh:mm time format.

    For example, say you have cell E2 set up with a start time (8:00 AM), and cell F2 with an end time (5:00 PM), and you want to limit meeting times between those times then select between in the Data box, enter =E2 in the Start time box, and then enter =F2 in the End time box.

Restrict data entry to text of a specified length.

  1. Follow steps 1-2 above.

  2. In the Allow box, select Text Length.

  3. In the Data box, select the type of restriction that you want. For example, to allow up to a certain number of characters, select less than or equal to.

  4. In this case we want to limit entry to 25 characters, so select less than or equal to in the Data box and enter 25 in the Maximum box.

Calculate what is allowed based on the content of another cell.

  1. Follow steps 1-2 above.

  2. In the Allow box, select the type of data that you want.

  3. In the Data box, select the type of restriction that you want.

  4. In the box or boxes below the Data box, click the cell that you want to use to specify what is allowed.

    For example, to allow entries for an account only if the result won’t go over the budget in cell E1, select Allow >Whole number, Data, less than or equal to, and Maximum >= =E1.

Notes: 

  • The following examples use the Custom option where you write formulas to set your conditions. You don’t need to worry about whatever the Data box shows, as that’s disabled with the Custom option.

  • The screen shots in this article were taken in Excel 2016; but the functionality is the same in Excel for the web.

To make sure that

Enter this formula

The cell that contains a product ID (C2) always begins with the standard prefix of «ID-» and is at least 10 (greater than 9) characters long.

=AND(LEFT(C2,3)=»ID-«,LEN(C2)>9)

Example 6: Formulas in data validation

The cell that contains a product name (D2) only contains text.

=ISTEXT(D2)

Example 2: Formulas in data validation

The cell that contains someone’s birthday (B6) has to be greater than the number of years set in cell B4.

=IF(B6<=(TODAY()-(365*B4)),TRUE,FALSE)

Data validation example to restrict an entry to a minimum age

All the data in the cell range A2:A10 contains unique values.

=COUNTIF($A$2:$A$10,A2)=1

Example 4: Formulas in data validation

Note: You must enter the data validation formula for cell A2 first, then copy A2 to A3:A10 so that the second argument to the COUNTIF will match the current cell. That is the A2)=1 portion will change to A3)=1, A4)=1 and so on.

For more information

Ensure that an e-mail address entry in cell B4 contains the @ symbol.

=ISNUMBER(FIND(«@»,B4))

Data validation example ensuring an e-mail address contains the @ symbol

Tip: If you’re a small business owner looking for more information on how to get Microsoft 365 set up, visit Small business help & learning.

Want more?

Connect with an expert. Learn from live instructors.

Create a drop-down list

Add or remove items from a drop-down list

More on data validation

Having multiple users of a workbook is a perfect brew for a barrel of problems. Imagine anyone having access to editing anything. Your reports will quickly become subject to alteration, human errors, and someone’s quirks.

A complete shield against that would be protecting the sheet/workbook. This will lock the sheet/file from any alteration or you can choose the option of selective alteration where all the cells on the sheet are protected except chosen ones. Now if only you can control what type of data goes into the selectively open cells too?

Find that wish granted because in today’s Data Validation lineup, we’re going into the details of what Data Validation is, how to apply it, the limitations, the options and settings, some examples of Data Validation rules, and all the tidbits of finding, removing and copying Data Validation.

You have got to be wondering what the essence of Data Validation is so…

Let’s get validating!

Data Validation in Excel

What is Data Validation?

Data Validation in Excel limits the type of data users can enter into a cell. E.g., if you are entering game scores with a score range of 1 to 5, you can use Data Validation to control the scores that go in the target cells to be between 1 to 5.

While that is the prime role of Data Validation, its prime use is creating a drop-down menu for a cell.

The options in Excel provide a list of rules to choose from. These rules determine the type of data that can be entered on selected cells on the worksheet. It is here that you will find the option of adding a drop-down list.

Using these rules, you can control the data type in the cell to be only numbers, dates, time, and characters of a given length, selected from a drop-down list (list also created using Data Validation), or you can define the criteria through a custom formula. An Input Message can be displayed with a cell with or without a validation rule added.

When Data Validation is applied to a selection of cells and invalid data is entered by the user, an error alert will be displayed:

What is Data Validation?

This is the default alert and through Data Validation, you can create a custom alert. Another feature of Data Validation is adding an Input Message to a cell that is quite identical to a comment in Excel.

That is what Excel’s Data Validation is in a nutshell. We’re sure you’re ready to jump to the how-to and we have it coming for you. We’ll begin with a simple case of adding Data Validation.

How to Add Data Validation?

Where will you find the Data Validation button? Hint: The Data tab. Everything you need from Data Validation can be found in the Data Validation icon in the Data Tools group. Now let’s see how to add Data Validation on the worksheet.

As a small example, let’s assume we are entering a passcode in a cell and you want it to pose an alert when an incorrect key is punched in. Use the steps ahead to add Data Validation to a cell to restrict the type of data that gets entered into the cell:

  • Select the cell(s) you want to add Data Validation
  • Go to the Data tab and click on the Data Validation icon in the Data Tools

How to Add Data Validation?

  • You will see a small Data Validation dialog box where all the main Data Validation business will take place. Currently, you can see that the validation criteria allow any value, without any restriction:

How to Add Data Validation?

  • We’re about to change that. In our example case, we want to ensure that all passcodes are 5-digit pins between 10000 to 99999. The Whole number rule will do for this.
  • Make the following changes to the Data Validation settings:
  • Click on the arrow in the Allow field and choose Whole number.
  • In the Data drop-down list, select between.
  • In the Minimum and Maximum fields, enter the smallest and largest number of the range you want to allow in the selected cell (i.e. 10000 and 99999 for us).

How to Add Data Validation?

  • When done, select the OK

The Data Validation dialog box will close. You will not see any overt changes since Data Validation is related to entering data. So go ahead and try to enter some invalid data in the cell e.g. we can try entering a 4-digit number. We will get an error alert.

How to Add Data Validation?

The Retry button gives another attempt at entering the valid data type. The Cancel button wipes out the data we have entered and the Help button redirects us to the Microsoft Support webpage. So yes, you really have no way around this other than entering the relevant type of data.

Overriding Data Validation

Right now, Data Validation might be looking all types of invincible but it has a couple of chinks in its armor. The first is that if Data Validation is applied to occupied cells, the values will stay as they are; there will be no rectification and no notification or indication that the data is invalid.

Secondly, if invalid data is value-pasted to a cell containing a Data Validation rule, while the rule will still stand, the invalid data won’t be restricted from being pasted and there will again be no rectification or indication of invalid data.

This shows us that Data Validation is only a data-entry control and will only work for data that is being entered; not data that already exists or is being pasted.

Now that you’re getting a basic idea of what Data Validation does, we’ll explore the Data Validation dialog box before we go into the scope of Data Validation with some examples.

Excel Data Validation Options & Settings

You just saw how to access the Data Validation settings from the Data tab. Let’s go through the rules and options in the settings to understand what types of data entry Data Validation can control.

Settings

Firstly, the face of the Data Validation options; the Settings tab. To set validation criteria or rules, you begin with choosing a rule from the Allow menu. If you do not find a suitable preset criterion, you can use the Custom option. Here you will need a formula to define the Data Validation criteria. We’ll briefly go over the preset rules.

Excel Data Validation Options & Settings

Any value

This is the default setting when no Data Validation is applied. Any value can be entered in the cells without any restriction. You can still add an Input Message to the cell(s) but for an error alert to show, there needs to be a rule in place.

Whole number

Allow only whole numbers to be entered in cells. You can further set the limit value(s) that will go into these cells once Data Validation is applied.

Excel Data Validation Options & Settings

Additional fields become accessible with the rules. E.g. when you select the Whole number criteria, from the Data field you can choose if the number should fall between a provided range or should be equal to or greater/less than a certain value.

Decimal

This is the decimal variant of the Whole number rule since the latter doesn’t allow decimal. The options are the same with Decimal as they are with Whole number; only that the data entered will allow decimal and whole numbers that meet the specified range of values.

List

Create a drop-down list for a cell with this rule. The content of the list can be entered into the provided field in the Data Validation dialog box or can be referred to from the worksheet.

Excel Data Validation Options & Settings

Unchecking the In-cell dropdown box will remove the drop-down menu which kind of kills the whole mojo of this rule but what will happen is that only the specified values can then be entered in the cell. The values manually entered using this rule will be case-sensitive.

Date

Restrict the data in the cells to be only entered as dates with the Date criterion. Set a start and/or end date to further limit the dates that will go on the worksheet.

Time

The Time rule will only allow time values in the cells. Entries can additionally be controlled by specifying the start and/or end time.

Text length

Text length limits the number of characters (whether numbers, letters, or symbols) that go into the cells.

Custom

Add a custom formula to expand the scope of Data Validation when you can’t find a match for your requirement in the predefined rules.

Checkbox – Ignore blank

Throughout the Data Validation rules, you may have noticed an Ignore blank checkbox. The role of this box is to ignore the blank cells from being treated as cells with invalid data since blank cells will not match most Data Validation criteria. Leave this box checked if you don’t want blank cells to be circled when circling invalid data (found out more about this feature later).

Checkbox – Apply these changes to all the other cells with the same settings

Let’s say you’ve selected a cell with Data Validation and open the Data Validation dialog box. When you mark this checkbox, all other cells on the worksheet that have the same validation criteria applied to them will be selected in the background.

This is useful if you don’t remember all the cells that you have applied a Data Validation rule to and want to select all the cells with that rule.

Button – Clear All

Clears Data Validation (comprising the validation rule and Input Message) from the selected cell, restoring the validation criterion to Any value.

Input Message

Onto the next tab in the Data Validation dialog box. This is the Input Message tab where you will learn about the settings regarding displaying an Input Message with a cell. The message will be displayed when the cell is selected and looks like an Excel cell comment.

This is an optional feature and merely a display item. Use an Input Message to notify a user about the contents of the cell, or the data type to be entered.

Let’s pick the example we were working on previously and see how we can add an Input Message to a cell.

  • Select the cell(s) that you want displayed with the Input Message.
  • Open the Data Validation dialog box from the Data tab > Data Tools group > Data Validation Then go to the Input Message tab.
  • Enter the title (optional) to display as the Input Message header as we have added “Passcode”.
  • Then add the Input Message in the given field.

Excel Data Validation Options & Settings

  • Click on the OK command to apply the settings.

Now, whenever that cell is selected, you will see the related Input Message in a pale yellow box.

Excel Data Validation Options & Settings

You will not see the Input Message if the relevant cell is not selected. Uncheck the Show input message when cell is selected box to stop the message from appearing.

This will not affect the Data Validation rule and you can enable the message any time again. However, you can also clear the title and message from the Input Message tab if there will be no use for it later.

The Clear All button will reset the settings of the entire Data Validation dialog box, Settings tab included.

Error Alert

This tab deals with the error alert that will be displayed when invalid data is entered in the cells with Data Validation. Excel has three styles of error alerts to choose from with each style having different commands and control. Let’s run you through each of them so you know which error alert you would want to deploy.

The standard title of the alert is “Microsoft Excel” and the error message is «This value doesn’t match the data validation restrictions defined for this cell.» if nothing is specified otherwise.

Stop

The Stop alert is the default error alert displayed when you set a Data Validation rule. It appears with a cross icon. The title and error message can be added by the user which will overwrite the standard alert. The settings are the same for all error alerts.

Excel Data Validation Options & Settings

The Stop alert restricts entering invalid data; with the Retry button, you will have to try entering the data again, the Cancel button will clear the entered data and the Help button will guide you to the support center.

Hence, with this alert style, there is no getting around «entering» invalid data. Why have we emphasized entering? There are ways around getting invalid data on the worksheet despite setting Data Validation and we’ll come to that later.

Excel Data Validation Options & Settings

Use the Style list in the dialog box to switch to another alert style.

Warning

The Warning error alert, shown with an exclamation point icon is a softer alert that gives the user the option of retrying the entry (by using the No button) but also gives the space of continuing with the invalid entry (by using the Yes button).

Excel Data Validation Options & Settings

Edit the title and message in the Data Validation dialog box if preferred.

Information

An even softer error alert form, the Information alert only lays out information (the default error message unless changed by the user) regarding the input data. Invalid data will still be accepted after clicking on the OK button. This alert is actually just like a reminder with hardly any restricting quality.

Excel Data Validation Options & Settings

Other than the alert styles, in the Data Validation dialog box, there’s a Show error alert after invalid data is entered checkbox and if you unmark it, even with the Data Validation rule set, no validation will be performed.

The use of this checkbox makes sense to temporarily disable the validation so the rule and error style is still saved to be enabled later. Unmarking the checkbox is also of use when you want to give the user the option to choose from a Data Validation list and also of adding a new value.

Data Validation Examples

What we have covered majorly until now is how to add Data Validation, what the options and settings entail, and different types of error alerts. Now we’ll proceed to different examples where we can apply different Data Validation rules so you know how to use Data Validation for your worksheets.

Heading back to the Settings tab in the Data Validation dialog box, here goes the first rule.

Whole number

The first couple of steps of applying Data Validation is to select the target cells and to open the Data Validation dialog box to set the criteria. To open the dialog box, go to the Data tab > Data Tools group > Data Validation icon.

We’re working on the Whole number Data Validation criterion. In the case example below, we are filling out students’ marks in an exam. We have the Data criterion set to between to define what numbers the marks should be between.

The limits that we have set for the lowest marks is 0 and the highest has been set to 50 marks by entering F3 as an absolute reference so it remains fixed for the rest of the selection. Instead of entering 50 directly as the upper limit, we have referred a cell so that we can enter different total marks for tests and exams that Data Validation will automatically take into account.

Data Validation Examples

Now click OK and try entering a number beyond the range of the specified limits. See what happens.

Data Validation Examples

You will get an error alert and you will know that you have entered invalid data. Try re-entering the value in compliance with the Data Validation criteria.

The Decimal rule works in the same way; only that it allows decimal whereas the Whole number rule doesn’t. If you’re dealing with decimals and integers, you can apply the Decimal rule as it also allows integers in the specified range to be entered.

List

Creating a small and simple list would require nothing more than punching in the items of the intended list, delimited by commas, as the source:

Data Validation Examples

But see this?

Data Validation Examples

This comes readymade for no one but it can be achieved in some surprisingly simple steps. This is a drop-down menu created for every cell. For data entry, this is a dream and is made using the List rule in Data Validation.

But before we get to the List rule, we need to lay out a couple of things in advance. Create a list of the items you want in the drop-down menu, name that range, then create a Data Validation list with the Named Range.

The list for the Named Range can be on the same worksheet as the target validation data or a different sheet. If you prefer the list hidden, you can keep it on the same sheet in a white font. Now you can check out the steps to create in-cell drop-down menus with Data Validation using a Named Range from a separate sheet.

  • Form a list of the items you want in the drop-down menu on a separate worksheet.

Data Validation Examples

  • Select the items of the list excluding the header.
  • Click on the Name box in the corner and type a name for this list.

Data Validation Examples

  • After typing the name for the range (our Named Range is Services), hit the Enter

Data Validation Examples

  • The Named Range is ready.

Data Validation Examples

  • Now go back to the sheet where you’re entering the data. Select the cells that you want to add drop-down lists to.
  • From the Data tab, select the Data Validation icon in the Data tools group.
  • Choose List from the Allow
  • Click on the Source field and press the F3

Data Validation Examples

  • A Paste Name box will be launched. Select the relevant Named Range, then press the OK

Data Validation Examples

  • The Named Range will appear in the Source field.
  • Select the OK command on the Data Validation dialog box too.

Data Validation Examples

The dialog box will close and the in-cell drop-down lists will be added to the selected cells. The arrow to access the drop-down list for a cell will appear when the cell is selected. Now the drop-down lists can be used to start data entry!

Data Validation Examples

If an entry is punched in that doesn’t completely match one of the items of the list, it will be blocked by Data Validation.

Data Validation Examples

Other than looking nifty, using in-cell drop-downs keeps the data entries consistent too.

Dynamic List

With a dynamic list, if you add an item to it, it will automatically be updated in the cell drop-down lists. The way to do that is to create an Excel Table out of the list (with header) along with making a Named Range out of it (without header).

Carrying on with the method we have shown you earlier, we can also extend the Named Range and the cell drop-downs will be updated as per the Named Range.

Let’s assume we are adding just one more service to the list. Add the item in the list that is on the separate sheet. Then select the original Named Range (Services in our case) without the new addition.

Data Validation Examples

Open the Name Manager (Ctrl + F3 keys) and extend the range from B3:B9 to B3:B10. This will include the new item in the range.

Data Validation Examples

Now when you check the in-cell drop-downs on the original sheet, it will include the new item!

Data Validation Examples

The other method is to create a Table before naming the range. Select the list with the header and create a Table from the Home tab > Styles group > Format as Table icon, selecting a table style from the menu.

Data Validation Examples

Once the same data is the items of a Table and Named Range, additions will automatically be incorporated in the cell drop-down lists. This works because an Excel Table is dynamic in nature and automatically includes additions.

Data Validation Examples

The Table will also update the Named Range which will in turn update the in-cell drop-down menus.

Data Validation Examples

Date

Use the Date rule to apply a Data Validation layer to dates in Excel. Not only will this ensure that the input data are dates but also that the dates are within the specified range.

For the example case, we have an extract of some sales data and are filling out the order and delivery dates of the products for the month of September. Begin by selecting the cells, opening the Data Validation dialog box, and selecting the Date criterion from the Allow section.

Now select between from the Data section to add the start and end dates. To keep the dates entered on the worksheet limited to September, the start date will be the 1st of September and the end date will be the 30th of September.

The dates can be fed directly in the dialog box or from the worksheet. To add them in the dialog box, use an Excel date format e.g. 9/1/2022.

Make sure to secure the dates as absolute references if added from the sheet and hit the OK button when done.

Data Validation Examples

Any date added in the cells with Data Validation that is out of the range of the start and end dates will trigger the error alert.

Data Validation Examples

Time

With the Time rule applied, no other input value will be accepted other than a time entry. Using a small example, we’ll show you the format to use in Data Validation for limiting the cells to contain a time value.

Setting up a meeting schedule for office hours would require the office timings as the start and end time. The format to use in the dialog box is 8:00:00 AM.

Tip: On the worksheet, change the format of a free cell to a Time format, enter the time and refer this cell in the Data Validation dialog box or copy the value and paste it in the dialog box.

Data Validation Examples

Apply the rule and you won’t be able to enter values other than time within the mentioned time range set through Data Validation – confirms error alert.

Data Validation Examples

Text length

We’ll now take an example where we are to limit the text length of a cell. You will be able to enter any type of character in text as long as the number of characters abides by the set text length.

As an example, we’ll confine the text length of our data column to equal 10 characters so that the phone numbers fed therein have a lesser chance of being subject to human error.

In the Data Validation dialog box, select the Text length rule. Choose the equal to option in the Data drop-down list and set the phone number digit length e.g., to 10.

Data Validation Examples

Activate these settings by clicking OK. Data Validation will make sure that the entered phone numbers aren’t a single digit above or below 10.

Data Validation Examples

Custom

This rule calls for a custom formula and the aim is to make it go beyond the functions of the preexisting rules in Data Validation and increase its scope. When it comes to custom formulas, there is so much that becomes open to us and that is why that calls for a whole section on its own.

Without further ado, we’ll start with Data Validation with custom formulas.

Formula-based Validation Rules

Earlier, we have been directly adding values or referring values from the worksheet to set the validation criteria which limits the use of Data Validation to the preset rules.

In this section, we are going to talk about using formulas in the preset and custom rules and throwing Excel functions into the works which will greatly expand Data Validation controls.

Dynamically limiting dates to 7 days before the current date, only entering weekdays, entering products of a specific code. This is definitely your regular Data Validation so learn how to do all of this below.

Tip: Using formulas in dialog boxes can be a little tricky because if it fails, it would be hard to pinpoint and tweak what part of the formula isn’t working. Use the formula on the worksheet first to see how it performs and then paste it in the dialog box.

7 Days Before & After TODAY

Let’s take today’s date as the 24th of September 2022. We’re filling out our worksheet containing the order and delivery dates of products that is forwarded daily to the dispatch department. The timeline is 15 days i.e. 7 days before and after the current date inclusive.

That makes our start and end date 17/9 and 1/10 respectively. And we can very well enter these dates directly but that will make a static limitation of the date range.

To keep the Data Validation dynamic, we’ll incorporate the TODAY function. The TODAY function returns the current date in the d/m/yyyy format. In the Data Validation dialog box, select Date and between as the first two criteria and enter the other two as:

Start date:

=TODAY()-7

End date:

=TODAY()+7

The start date is set to be 7 days before the current date and the end date is 7 days after. This keeps our range at 15 days.

Data Validation Examples

For the current date, you will not be able to enter a day after 01-09-2022 and the next day the limit will become 02-09-2022 automatically.

Data Validation Examples

Only Weekdays

Now let’s suppose we’re closed for the weekends; we will need to make sure that the delivery dates are only assigned to weekdays. Data Validation on its own wouldn’t know how to restrict date entries to just the weekdays but it can take the help of a formula and that’s where the WEEKDAY function comes in.

The WEEKDAY function, when fed a date, returns a number from 1 to 7 indicating the day of the week the date falls on.

Access the Data Validation dialog box from the Data tab and choose the Custom criteria. The only other requirement now will be a formula so enter this one in the given field:

=WEEKDAY(D3,2)<6

First off, the second argument of the WEEKDAY function, that is “2” in our example case, is the number for the type of week (Monday to Sunday). To pick a different week type, start punching the function on the worksheet and select the type from there.

In the formula mentioned above, the WEEKDAY function checks what day the date in D3 falls on (Tuesday in this case) and returns the number of Tuesday as per the selected week type. According to week type 2, Tuesday is the second day of the week so the outcome of the WEEKDAY function is 2.

In the other part of the formula, we have <6. With this bit, 6 being the number for Saturday, we are ensuring that the result of the WEEKDAY function is lesser than 6 and hence, earlier than Saturday. Since 2 is lesser than 6, the first date i.e. 20/9/2022 is good to go.

Data Validation Examples

Try entering a weekend date; that’s foolproof Data Validation there:

Data Validation Examples

Applying the same formula on the sheet confirms that the corresponding numbers of all the days are less than 6:

Data Validation Examples

Beginning with Specific Characters

Data Validation can limit the entries beginning with specific characters. To track the entries, we’ll use the COUNTIF function that counts the number of cells in a range that fulfills the defined condition.

The product codes we are using in our case example are made up of product category initials (e.g. HL is for Home & Lifestyle) and then a 4-digit number code.

Use the following formula to only list the products with HL as the starting code:

=COUNTIF(B3,"HL-*")

Don’t worry about setting a different Data Validation rule separately if you’re aiming for two codes instead of one. Just add a plus sign + and repeat the formula with the other code:

=COUNTIF(B3,"HL-*")+COUNTIF(B3,"EA-*")

The COUNTIF function checks B3 for the code HL- in the beginning. The asterisk is added as a wildcard character that will take place of any number of characters in the formula since the product code will obviously have a different mix of numbers.

Data Validation Examples

If the entry meets the condition of beginning with the code HL or EA, it will be accepted by Data Validation while the others will be blocked:

Data Validation Examples

For grouping purposes, you’ll find sorting and filtering easier but for blocking other entries, Data Validation is the go-to. How would things change if, instead of the beginning, the characters were in the middle of the product code? Read on.

String Containing Specific Characters

By now, you have probably realized that we can get Data Validation to do so much more than the basics that it only becomes a matter of using the right formula.

If your characters of interest are anywhere in the string, beginning, mid or end, they can still come under the band of Data Validation using the FIND or SEARCH function.

The FIND function returns the position of the baby text string from the parent text string. You can use either of the two functions; the FIND function is case-sensitive while the SEARCH function is not. Use this formula with the Custom criteria in the Data Validation dialog box:

=FIND("HL",B3)

Just the FIND function on its own will restrict product codes without HL from being entered:

Data Validation Examples

The formula didn’t find HL in the last code and so it cannot be entered:

Data Validation Examples

You can apply this limitation regarding any character or number of characters. E.g. to allow only email IDs as the input, we can use the following formula:

=FIND("@",B3)

Assuming B3 is the first cell of the selection of the range where we are applying Data Validation.

No Duplicates

Here’s one more flex of Data Validation for the day; blocking duplicate entries. Making the COUNTIF function part of a custom formula, we can restrict repeated entries in the cells that Data Validation has been applied to.

Let’s take this example. While noting down entries for an interschool creative writing competition, we realized we could be making the same entry twice and we also realized that it would be a good idea to prevent that from happening in the first place.

Look at this formula and enter it in the formula field using the Custom rule in the Data Validation dialog box:

=COUNTIF($B$3:$B$17,B3)<2

The range that we want to keep free of duplicates is B3:B17. The condition is that the occurrence of B3 in the mentioned range should be less than 2 (you could also write =1). This way, any entry cannot be made twice as each input will be checked against the rest of the range.

Data Validation Examples

An attempt at re-entering the same student failed!

Data Validation Examples

Here’s some food for thought. The Goblet of Fire could have been secretly wired to Excel. Think about it.

Find Invalid Data on the Sheet

When you apply Data Validation to a dataset or paste values on Data Validation cells, you will not be notified of invalid data and it may seem that everything is spot on.

Indication: you will have to find the invalid data on the sheet. Good thing that’s not a very technically far-out problem. By invalid data, we are referring to the value in the cell not meeting the cell’s Data Validation criteria.

There’s an option in the Data Validation menu to circle all the invalid data on the sheet with a red border. We like to call that Excel’s teacher syndrome.

To find all the invalid data as per the Data Validation rule governing those cells, head to the Data tab’s Data Validation icon and click it and select the Circle Invalid Data option.

Find Invalid Data on the Sheet

And that’s it! All the invalid data of all Data Validation rules on the sheet will be circled in red:

Find Invalid Data on the Sheet

And when you want the teacher gone and want to take down all the red circles, use the Clear Validation Circles option or save the file to erase the highlighted invalid data.

Find Invalid Data on the Sheet

If you find that the circling isn’t working properly, use Find & Select to ensure if Data Validation is applied to those cells or not because obviously; the data will be invalid only if Data Validation has been applied in the first place. Speaking of Find & Select, do you know how to use this feature for Data Validation?

How to Find Cells with Data Validation

You may have a good few Data Validation rules spread across your spreadsheet and you’re not about to manually check every other cluster of datasets for validation. Here’s an easy way to find out which cells are using Data Validation and it is with the Find & Select feature. Find & Select will select all the cells with Data Validation no matter how many rules and how dispersed they are.

To find all cells on the worksheet with Data Validation applied, on the Home tab, click on the Find & Select icon in the Editing group. From the menu, select Data Validation.

How to Find Cells with Data Validation

In our example case, we have applied one Data Validation rule on C3:C12 and another on F3. Both lots have been selected, confirming their Data Validation status.

How to Find Cells with Data Validation

Note: How does this method differ from the Apply these changes to all the other cells with the same settings checkbox? If you want to find the cells covered by all the Data Validation rules in a sheet, go ahead with Find & Select. To find the cells covered by one particular rule, go ahead with the checkbox.

How to Edit Data Validation Rules

Editing one Data Validation cell is easy from the settings but how do we edit all the cells that carry the same rule? While editing, there’s one small bit you need to take care of and it’s the Apply these changes to all the other cells with the same settings box.

You can edit cells of one rule at a time whether a single cell, a range of cells, or all the cells of a single rule. To edit all the cells belonging to a rule select any cell containing that rule and open the Data Validation dialog box using the Data Validation icon.

How to Edit Data Validation Rules

Edit the rule according to your requirement; we are changing the text length from 10 to 11 digits. Next, mark the Apply these changes to all the other cells with the same settings checkbox. As soon as you do, all the cells with the original rule will be selected in the background.

How to Edit Data Validation Rules

Apply the changes and check if you can get away with entering invalid data.

How to Edit Data Validation Rules

How to Remove Data Validation Rules

Removing Data Validation requires using the Clear All button in the Data Validation dialog box and how much Data Validation you want to remove will depend on the selection of cells.

Remove Data Validation from a single cell by selecting that cell and accessing the Data Validation dialog box. In the Settings tab, click the Clear All button in the bottom-left corner. This will clear the selected cell of the Data Validation rule and Input Message and will reset the Error Alert settings.

How to Remove Data Validation Rules

The OK command will seal the clearing of settings and you can see below that we are not bound to enter an 11-digit number now:

How to Remove Data Validation Rules

Remove Data Validation from all cells with the same rule

If there’s only one rule you want to dispose of, select any cell of that rule, open the Data Validation dialog box, select the Apply these changes to all the other cells with the same settings checkbox, click on the Clear All button, and then on the OK button.

Remove Data Validation from all cells on the sheet

Press Ctrl + A on the worksheet to select all the cells. Head to the Data Validation dialog box to use the Clear All button to remove all the Data Validation rules on the sheet.

Then hit the OK button.

How to Copy Data Validation to Other Cells

A plain copy & paste of a cell with Data Validation will paste the Data Validation rule and the value of the cell. To leave out the value and paste the rule, you can use the Validation option in Paste Special. If you don’t know how to use Paste Special, here’s what you need to do to copy Data Validation to other cells:

  • To copy a particular Data Validation rule, select any cell with that rule and press the Ctrl + C keys to copy it.
  • Now select the cell or the range where you want to paste the rule. Right-click the selection and click on Paste Special in the context menu.

How to Remove Data Validation Rules

  • In the Paste Special dialog box, select the Validation radio button and then the OK

How to Remove Data Validation Rules

As a keyboard shortcut, press the Alt, E, S keys in succession to launch the Paste Special dialog box. Press the N key to select the Validation option and press the Enter key in place of clicking on the OK button.

The full keyboard shortcut after selecting the target cells becomes Alt, E, S, N, Enter in succession.

Data Validation will be copied to the target cells.

That was Data Validation for you, providing some form of sheet protection with data entry. Use the Data Validation rules to restrict what goes into a cell and expand the scope and usability by incorporating formulas. Two cheers to finding validation in our Excel life.

Data Validation in Excel

Excel Data Validation (Table of Contents)

  • Data Validation in Excel
  • How to Create Data Validation Rule in Excel?
  • Valuation criteria of data validation Settings

Data Validation in Excel

Data validation is a feature in MS Excel used to control what a user can enter in a cell of an excel sheet. Like, restrict entries in a sheet, such as a date range or whole numbers only. We can even create dropdowns as well, which saves un-necessary space and shows the values in a single cell. Also, we can create a customized message which will appear user insert any incorrect value or an incorrect format.

As an example, A user can specify a meeting scheduled between 9:00 AM and 6:00 PM.

As we can use data validation in excel to make sure a value is a positive number, a date between 15 and 30, make sure a date occurs in the next 30 days, or make sure a text entry is less than 25 characters etc.

Locate in MS Excel

  • Click on Data Tab in the Menu bar.

Data Validation Step 1

  • Select on Data Validation from the toolbar under the Data Tab:

Data Validation Step 2

How to Create Data Validation Rule in Excel?

Let us understand the working of Data validation in excel by some examples.

You can download this Data Validation Excel Template here – Data Validation Excel Template

Example #1

We can restrict a user to enter a whole number between 0 and 10.

Execute the Below mention steps for the creation of the data validation rule in excel:

Step 1: Select B2 Cell.

Data Validation Example 1-1

Step 2: Go to the Data tab, click on Data Validation from Data in the toolbar.

Data Validation Example 1-2

Step 3: A data validation Pop-Up will open:

Data Validation Example 1-3

Step 3.1: On the Settings tab, Click on Allow drop-down under validation Criteria.

Data Validation Example 1-3.1

Step 3.2: Select the Whole number, then Some more required options will be enabled.

Data Validation Example 1-3.2

Step 3.3: Select between from the drop-down of the Data list, Enter the Minimum and Maximum number for restriction. And click ok.

Data Validation Example 1-3.3

Step 3.4: All settings will apply to the selected cell.

Now Enter 1 in cell B2- It will allow a user to enter any whole number from 0 to 10.

Data Validation Example 1-3.4

Now Enter 11 in cell B2- It will throw by default error.

Data Validation Example 1-3.5

Example #2 – Set Input Message and Error Alert

We can restrict a user to enter a limited text.

Step 1: Select B5 Cell from Example 2 Sheet.

Data Validation Example 2-1

Step 2: Click on the data validation tool from the Data Menu Bar and select Text Length in Allow drop-down.

Data Validation Example 2-2

Step 3: Select equal to from the data list drop-down.

Data Validation Example 2-3

Step 4: Enter your desired length of the password (as an example 11).

Data Validation Example 2-4

Step 5: Click on the Input Message tab and provide a message displayed on the selection of cell.

Data Validation Example 2-5

Step 6: Click on the Error Alert tab, provide a Title and the Error message, which will be displayed if a user entered an invalid length password.

Data Validation Example 2-6

Step 7: After that, click the Ok button, the setting will be applied to the selected cell.

On the Selection of Cell, an Input message will be displayed.

Data Validation Example 2-7

Enter a text which has a text length of 11. It will be selected successfully.

Data Validation Example 2-8

Now enter an invalid password. It will throw the described error message.

Data Validation Example 2-9

Example #3 – Custom option for e-mail address validation

Step 1: Select the C2 cell, Go to Data Tab and click on Validation data in the toolbar.

Example 3-1

Step 2: Select custom in Allow drop-down.

Example 3-2

Step 3: Write a formula for selecting only value if it is having ‘@’.

Example 3-3

Step 4: Click on the Input Message tab, provide the message, which will be displayed on the selection of a cell.

Example 3-4

Step 5: Click on the Error Alert tab, provide the Title and an Error message, which will be displayed if a user entered an invalid length E-mail Id.

Example 3-5

Step 6: After that, click the Ok button, the setting will be applied to the selected cell.

On the Selection of Cell, the Input message will display.

Example 3-6

Enter a valid e-mail id – It will be selected successfully.

Example 3-7

Now enter any invalid e-mail Id- It will throw a described error Message.

Example 3-8

Valuation criteria of excel data validation Settings

  • Any Value – To provide any type of data.
  • Whole Number – Enter only whole numbers.
  • Decimal – Enter only decimal numbers.
  • List – Pick data from the drop-down list.
  • Date – Accept the only date.
  • Time – Enter only time.
  • Text Length – Fixed the length of the text.
  • Custom – Enter a custom formula.

Conditions in data list in Valuation criteria settings

Between, not between, equal to, not equal to, greater than, less than, greater than or equal to, less than or equal to.

Some more condition of excel data validation Settings

  • If a user wants to ignore the blank, then there is a checkbox called Ignore.
  • If a user selects between, then a user needs to select the Minimum and Maximum values for the cell(s).
  • If a user wants to apply these changes to all other cells with the same setting, then there is a checkbox that needs to mark, and it will apply to the remaining cells in the sheet.

When to Use Data Validation in Excel?

  • Best used when a user wants to share a sheet with another user, and he wants the data entered to be accurate and consistent.
  • Restrict entries to predefined items in a list.
  • Restrict numbers outside a specified range.
  • Restrict dates outside a certain time frame.
  • Restrict times outside a certain time frame.
  • Limit the number of text characters.
  • Validation of the data, which is available on other sheets or workbook.
  • Choose to be displayed an Input Message when a user clicks on a cell as a user’s guide.
  • A user can customize the error alert; it can be anything as per a user-defined.

Things to Remember About Data Validation in Excel

  • If a user wants to create a data validation rule in the workbook for excel web apps or Excel services, then he needs to create an excel data validation rule on the desktop first.
  • If one user sender a workbook to another, then first, a user needs to make sure that the workbook is unlocking; otherwise second, a user is never able to access the workbook cells to fill value.
  • Always make in mind that there is no error in a formula like #REF! or #DIV/0!
  • Anyone who can create a data validation rule in the filled cell MS excel will not detect it.

How to Remove the Excel Data Validation rule?

A user can remove excel data validation from a cell, select the cell, click Data Validation, and then click Clear All.

A user can modify or delete the excel data validation rule only if the inherited sheet is unprotected. If it is password protected, contact the owner of the workbook. Only he can help to unprotect the workbook. As there is no way to recover or lost the password option in MS Excel.

Recommended Articles

This has been a guide to Data Validation in Excel. Here we discuss how to create Data Validation in excel along with excel examples and a downloadable excel template. You may also look at these useful functions in excel –

  1. Excel Data Visualization
  2. Excel Database Template
  3. Excel Data Filter
  4. Excel Data Bars

See all How-To Articles

Data Validation is a tool in Excel that lets you restrict which entries are valid in a cell. Here are 10 rules and techniques to help you make the most out of Data Validation and its many features.

  1. Use Drop-Down Lists
  2. Data Validation Based on Another Cell
  3. ToolTips and Error Messages
  4. Options and Settings
  5. Date and Time Formats
  6. Set a Character Limit
  7. Validate Phone Numbers and Emails
  8. Custom Formulas
  9. Change or Remove Data Validation Rules
  10. Issues and Fixes

limit restrict cell values 3

Use Drop-Down Lists

The most useful type of data validation is the drop-down list feature. For instructions on creating a drop-down list, see Create or Add a Drop-Down List in Excel and Google Sheets.

DDList intro

There are plenty of uses for drop-down lists and many ways to create them. For example, a simple yes/no drop-down list like the one below can be added as a quick and dependable indicator in a spreadsheet.

YesNo Intro

You can also use VBA to create a drop-down list in a cell. Enter this code in the VBA editor:

Sub DropDownListinVBA()
Range("A2").Validation.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Formula1:="Orange,Apple,Mango,Pear,Peach"
End Sub

Dynamic Drop-Down Lists

  • When you create a drop-down list based on a range of cells using a data validation rule, if the data in that specific range changes, then the values in the drop-down list also change.

dynamicdropdown intro

  • Go a step further with a cascading drop-down list based on the value that is selected in a different list. In the example below, the user has selected LG as the Phone Make. The list of Phone Models then shows only the LG models. If the user were to select either Apple or Samsung, then the list would change to show the relevant models for those makes of phone.

CascadingIntro

  • An alternative method is to use an IF statement within the data validation feature to show a specific list that changes according to what the user selects. In the example below, if the user selects Show Fruit, then the fruit drop-down list is shown, whereas selecting Show Meat brings up the meat drop-down list.

drop down list if statement Main

Filter Data With a Drop-Down List

You can use Excel’s filter tool alongside a drop-down list for extended functionality.

  • Filters and drop-down lists are similar and even use the same keyboard shortcut (CTRL + SHIFT + L). In a data validation context, the shortcut activates a drop-down menu.

Toggle Autofilter

  • A drop-down list can also be used as a filter in Excel. It enables you to extract rows of data that match the entry in the drop-down list and return these rows to a separate area of the worksheet.

filter intro

Drop-Down List Formatting and Display Tools

  • If you want to create a drop-down list where the background color depends on the text selected, you can use Conditional Formatting to amend the background color when an item from the list is selected.

DropDown Intro

  • When you create a drop-down list, the default value of the cell where you have placed the list is usually blank. It can be useful to pre-populate this cell with either a default value or a message to the user, such as Select…

DD Default SelectList

  • Once you’ve created a drop-down list, you can use the SORT and UNIQUE Functions to sort the drop-down list into alphabetical order.

DropDownSort Intro

  • To make a drop-down list more readable, you can group a list of items by category (phone models in brand groups, for example).

drop down subcategories final data

AutoComplete Drop Down

AutoComplete is a useful feature of Excel in that it can reduce the number of characters you need to type in each cell. The standard data validation drop-down functionality does not support AutoComplete. However, you can learn here how to approximate autocomplete with a drop-down list. Then, when you start typing the first letters of an entry in the drop-down list, the rest of the entry automatically shows up.

AutoComplete intro

Drop Down Populates Another Cell

  • Selecting an item from a drop down can populate a different cell in Excel and Google Sheets. For example, in the graphic below, Patel is selected from the list, and the cell below is then populated with the value 34. You can learn how to do this by clicking here.

DropDownPopulates intro

  • Using a drop-down list, you can also insert a picture into another cell automatically.

ChangePicture Int

Data Validation Based on Another Cell

When entering values in Excel, you can restrict the data that is entered into any range of cells based on text or a value held in another cell.

DataValidation Example

  • When you create a drop-down list, you can write a custom input message that is seen on the screen when a cell is selected. This input message can also be referred to as a ToolTip.

input message data validation 4a

  • You can also customize the output (error alert) message that is returned to the user if invalid data is entered into a cell.

enable error alert data validation final

Options and Settings

  • There are seven different data types you can select from the Allow box of the Validation criteria: Whole number, Decimal, List, Date, Time, Text length, and Custom.
  • The Ignore blank option is only available if you are actually editing a cell that has that option switched off.

ignoreblanks checked

  • You can also choose, when editing a data validation rule, whether or not to apply the changes to other cells with the same settings.

Date and Time Formats

You can use Data Validation to restrict the format entered into a cell to ensure it is a date, and also to restrict the entry to be set between a start date and an end date.

DatavalidationDates intro

Set a Character Limit

In Excel, the number of characters allowed in a single cell is 32767. However, you can set your own character limit for a text cell.

set a character limit data validation final

Validate Phone Numbers and Emails

  • You can use Data Validation to ensure that a phone number is entered correctly into Excel.

validate phone numbers final data

  • You can also use Data Validation to ensure that an email address contains a @ sign and does not have any spaces or commas in it.

EmailDataValid Intro

Custom Formulas

You can write a custom formula to make your own data validation rules. In the example below, the formula ensures that the data in a cell begins with certain text.

data validation must begin with

Custom Formula Examples

  • You can use the INDIRECT Function in Excel in conjunction with a data validation drop-down list to create a cell reference from text.

INDIRECT Main Function

  • Use the ISNUMBER Function to check that the data inputted is in fact, a number. Data Validation has a built-in Whole number option, but you can generalize further with a custom formula.

data validation numbers

  • Use a the ISTEXT Function to check for text. The example below allows only text values in the cells with data validation applied.

Validate Data Validation

  • You can use a data validation drop down with the COUNTIF Function to count cells that meet certain criteria and return a total.

mega article drop down

  • COUNTIF is also useful for preventing users from entering duplicate values.

prevent duplicate entries data validation final

  • A risk score matrix is a matrix that is used during risk assessment in order to calculate a risk value by inputting the likelihood and consequence of an event. You can use a data validation drop down in conjunction with the VLOOKUP and MATCH Functions to create a risk score matrix.

Change or Remove Data Validation Rules

  • If you have a data validation rule set in Excel, you can find any restricted values by selecting Data validation in the Go To Special dialog box.

restricted values data validation

  • You can copy data validation rules from one set of cells to another set of cells by using the Paste Special command (CTRL + ALT + V).

DataValidationCopy intro

  • If you already have rules set up in a worksheet, you can amend the validation rules should your requirements change.

change data validation

  • You can amend the contents of a drop-down list by following the instructions in this tutorial.

dropdown intro

  • You can easily update (change, extend, or have fewer items) a drop-down list by adding or deleting items from the list’s source range.

update drop down list 1

  • If data validation on a range is no longer required, you can remove it.

datavalidation remove cleared

  • If you no longer require a drop-down list, you can easily remove the data validation settings by following the instructions in this tutorial.

RemoveValidation Intro

Issues and Fixes

  • If you have a value in Google Sheets that does not match the items in your drop-down list (an invalid item), you get a red triangle in the top left corner of the cell. To get rid of this triangle, you can follow the steps in this tutorial.

red triangle visible

  • There are a number of reasons why your data validation rule or drop-down list is not working correctly. You can troubleshoot these issues by referring to this tutorial.

data-validation error drop down

  • A mismatch error can occur when you run VBA code. The error stops your code from running completely and flags the error by means of a message box. One of the ways you can prevent this from happening is to use Data Validation on the spreadsheet to prevent the user from causing worksheet errors in the first place. Only allow them to enter values that don’t cause worksheet errors.

PIC 01

Types of Data Validation

By default, data validation allows any value to be placed in the cells.

There are, however, various validation criteria options: 

  • Whole number 
  • Decimal 
  • Date 
  • Time 
  • Text length 
  • Values from a list 
  • Custom (formula-based) 

 For the first five options enables you to specify ranges or specific values.

The last option allows you to add custom criteria for more flexibility. 

Note that adding a new row below this range will not be automatically captured unless it is inserted within the existing range. 

Adding new options to the dropdown 

There are various ways to do this: 

a) Expand the data validation reference to include the new row 

This means that if the original range is MASTER$A$4:$A$6, this should be manually changed to MASTER$A$4:$A$7 to include the newly added row. 

b) Insert a row within the existing specified range 

Since the range originally specified was MASTER$A$4:$A$6, insert a row between 4 and 6. 

c) Drag the new row into the range using the SHIFT key 

  • Add a new entry at the bottom of the range. If the range is MASTER$A$4:$A$7, add the entry in cell A8. 

Click on the new row and hold the SHIFT key as you drag cell A8 into the original range. 

d) Using an expandable cell reference 

  • Convert the range into an official Excel table by clicking anywhere inside the data set and press CTRL + T. 

Change formatting based on preference under Design > Table Styles. 

Rename the table under Design > Table Name. By default, it is called Table1. In this example, it is renamed to TableDiv. 

  • To refer to this range, the syntax is =Table_name[header_name]. In this example, is it TableDiv[Division]. This allows the entire range to expand when new rows are added.  
  • Go back to the cell where the data validation is needed and change the source. Since data validation is unable to process table references, there are two workaround for this:  
  1. Use the INDIRECT() function to convert this text into an address. 

This now becomes =INDIRECT(“TableDiv[Division]” 

2. Use the Formulas > Name Manager to give the table reference a name to be used as a data validation criteria 

This method allows you to add a new entry at the bottom of the range without the need to manually expand the data validation through methods 1 or 3. 

Adding input and error messages

This will serve as a guide for users by displaying a message as they select the cell or if the value specified is invalid. 

Input message

  1. Select Data > Data Validation 
  2. Go to the Input Message tab 
  3. Tick the box to show an input message when the cell is selected 
  4. Specify the message to be displayed 

Error Alert

  1. Select Data > Data Validation 
  2. Go to the Error Alert tab 
  3. Tick the box to show an error message after invalid data is entered 

4. The default message shown if invalid data is entered looks like this 

5. To setup a custom alert, select a style and specify the message to be displayed 

Applying data validation to other rows

In order to apply the data validation criteria to other rows: 

  1. Highlight the area with existing data validation set up 

2. Press CTRL + C 

3. Highlight the rows where you want to paste the data validation criteria 

4. Right click > Paste Special 

5. Select Validation. 

Published on: May 10, 2018

Last modified: February 23, 2023

Microsoft Most Valuable Professional

Leila Gharani

I’m a 5x Microsoft MVP with over 15 years of experience implementing and professionals on Management Information Systems of different sizes and nature.

My background is Masters in Economics, Economist, Consultant, Oracle HFM Accounting Systems Expert, SAP BW Project Manager. My passion is teaching, experimenting and sharing. I am also addicted to learning and enjoy taking online courses on a variety of topics.

Понравилась статья? Поделить с друзьями:
  • Adding to an array vba excel
  • Adding the word as in english
  • Adding the suffix ful to a word
  • Adding text to photos in word
  • Adding text to images in word