Restrict Cell to Accept Only Time Using Data Validation
For example, we want to ask user to enter the Time in a cell but the condition is that the entered Time should be between “Start Time” and “End Time”. If user enters any other Time beyond this range then the highlighted cell should not accept it.
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 cell to accept only “Time”:
1. Select the cells in which we wish to restrict the “time”. In this case we want to restrict “time” in cell “B5”.
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: Time
b. Data: Between
c. Start Time: Enter formula as “=B2” (As we have entered Start Time in cell B2)
d. End Time: Enter formula as “=B3” (As we have entered End Time in cell B3)
5. By entering the above values click on “OK” button and with this we can restrict the Times in selected cell “A5”.
6. If we try to enter the “time” beyond the given time range then excel will throw an error as shown in below image.
More Criteria’s to restrict Cell to Accept Only Time:
In above example, we have seen only one criteria to restrict cell to accept only “time”. There are some additional criteria’s available in excel by using which we can restrict the “time” in a cell.
These additional criteria’s are as listed below:
1. Between: With this option we can restrict cell to accept “time” which are between provided two “time” values.
2. Not between: With this option we can restrict cell to accept “time” which is not between provided two “time” values.
3. Equal to: With this option we can restrict cell to accept “time” which is equal to provided “time” value.
4. Not equal to: With this option we can restrict cell to accept “time” which is not equal to provided “time” value.
5. Greater than: With this option we can restrict cell to accept “time” which is greater than provided “time” value.
6. Less than: With this option we can restrict cell to accept “time” which are less than provided “time” value.
7. Greater than or equal to: With this option we can restrict cell to accept “time” which are greater than or equal to provided “time” value.
8. Less than or equal to: With this option we can restrict cell to accept “time” which are less than or equal to provided “time” value.
In this way we can restrict text length in excel with the help of various options.
Comments
Post a Comment