Home > Software design >  Data validation for time input in Google Sheets
Data validation for time input in Google Sheets

Time:01-25

I am searching for a solution that would allow users to insert time values only in this format: hh:mm, and reject if something else is inserted. Something similar like data validation for date - Data validation -> Is valid date -> Reject input.

I tried to search and adjust a Regexmatch formula for this one, with no success, but I am open for other suggestions also.

Thank you in advance!

CodePudding user response:

use custom formula:

=REGEXMATCH(""&A1; "\d{2}:\d{2}")

if you want to block inputs like: 75:99 then try:

=REGEXMATCH(""&A1; "\d{2}:\d{2}")*((A1*1)<=1)

CodePudding user response:

SUGGESTION

Perhaps you can try using a more specific regex such as the one sample from enter image description here

Demo:

E.g. Any text or date formats won't be accepted.

enter image description here

  • Related