Restrict Text Length using Data Validation



In this blog post we will learn to restrict text length with the help of “Data Validation” functionality in excel.

For example, we want to ask user to enter Postal Code in the excel sheet. In India postal code is always with 06 digits. We want user to always enter 06 digits in this field so that we will get correct input data from user.


For this we will use “Data Validation” functionality in excel. “Data Validation” can be found in “Data” tab under “Data Tools” group.


Now let’s see how we can use this “Data Validation” command to restrict text length:

1. Select the cells in which we wish to restrict the cell length. In this case we want to restrict text length in cell “B2”.


2. Click on Data Validation command under “Data Tools” group which will appear 03 further options and out of these 03 options again select “Data Validation”.



3. Once we click on “Data Validation” command, one dialog box named as “Data Validation” will appear on screen.



4. Under this dialog box, click on “Settings” tab and select the values in respective fields as shown below:

a. Allow: Text Length
b. Data: Equal to
c. Length: 6



5. By entering the above values click on “OK” button and with this we can restrict the text length in selected cell “B2”.


6. If we try to enter the value for which text length is not equal to 6 then excel will throw an error as shown in below image.



More Criteria’s to restrict text length:

In above example, we have seen only one criteria to restrict text length. There are some additional criteria’s available in excel by using which we can restrict the text length.

These additional criteria’s are as listed below:




1. Between: With this option we can restrict text length which is between provided two values.

2. Not between: With this option we can restrict text length which is not between provided two values.

3. Equal to: With this option we can restrict text length which is equal to provided value.

4. Not equal to: With this option we can restrict text length which is not equal to provided value.

5. Greater than: With this option we can restrict text length which is greater than provided value.

6. Less than: With this option we can restrict text length which is less than provided value.

7. Greater than or equal to: With this option we can restrict text length which is greater than or equal to provided value.

8. Less than or equal to: With this option we can restrict text length which is less than or equal to provided value.

In this way we can restrict text length in excel with the help of various options.

Comments

Related Topics..

Fill Up, Down, Right & Left in Excel

Excel Shortcuts Ctrl A to Ctrl Z

Select all cells highlighted with specific color at a time

How to Remove Duplicate Entries from Multiple Columns in Excel

Excel Pivot Table

Exploring Font Colors and Fill Colors in Excel

Insert Multiple Rows in Excel Based On Cell Value

Doughnut Chart in Excel

Conditional Formatting:Highlighting Above Average and Below Average Values

Bold, Italic and Underline Commands from Font Group