Limiting cells to be filled out by specific characters

masud8956

Board Regular
Joined
Oct 22, 2016
Messages
163
Office Version
  1. 2016
  2. 2011
  3. 2007
Platform
  1. Windows
Hi all!

I have a range of cells, say A1:F30 where I want the users to be able to enter the characters 0 to 9 a colon [:] only. The cells are formatted as [h]:mm and the colon will always appear in between the numeric values e.g. 1:15, 2:45, 10:05 etc

I tried Data Validation with the following formula:
Code:
=IF(A1="",TRUE,IF(ISERROR(SUMPRODUCT(SEARCH(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),"0123456789:"))),FALSE,TRUE))

Problem is, the cells now accept nothing but numeric value but do not accept the colon while I am trying to insert some durations at those cells.

What modification do I need to make?

Thanks.
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
You could validate a range of numbers.
Allow: Decimal. Betwen, minimum: 0.000694444444444444, maximum: 0.999305555555555.
This will only allow you 00:01 until 23:59.
Test it

valid%20time.jpg

https://www.dropbox.com/s/4d87397no5fabfb/valid time.jpg?dl=0
 
Upvote 0
Thanks for the nice solution. It will do the job for me.

Surprisingly, Data Validation with the formula
Code:
=ISNUMBER(A1)
also worked nicely.
 
Upvote 0
Thanks for the nice solution. It will do the job for me.

Surprisingly, Data Validation with the formula
Code:
=ISNUMBER(A1)
also worked nicely.



IsNumber will allow you any number, decimals, integers and more than 24 hours
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,244
Members
452,622
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top