英文:
How to make sure date entered in mm/dd/yyyy format is valid on Google Sheets?
问题
我想在Google表格上添加一个数据验证公式,以确保以mm/dd/yyyy格式输入的日期是有效的。
基本上,我想确保mm只能在01-12之间,dd只能在01-31之间,yyyy只能在2010-2050之间。
我不知道要使用什么公式来实现这个目标。实际上,我不确定如何访问输入的字符串的各个部分(mm、dd、yyyy),以便我可以为它们输入条件。
英文:
I want to add a data validation formula on Google Sheets to make sure that the date being entered in mm/dd/yyyy format is valid.
Essentially, I want to make sure that mm can have values only from 01-12, dd can have values only from 01-31, and yyyy can have values only from say 2010-2050
I dont know what formula to use for the same. Essentially, I'm not sure how to access the individual parts (mm, dd,yyyy) of the string being entered so that I may enter conditions for them.
答案1
得分: 2
我会检查菜单中的“数据验证”选项(顶部菜单栏中的“数据” ->“数据验证”)。它包括一个选项,用于检查输入是否为有效日期,并可以选择向用户显示警告但仍接受输入,或显示警告并拒绝输入。您可以在此处查看它的实际操作这里。
英文:
I would check out the Data validation
option in the menus (Data
in the menu bar at the top -> Data validation
).
It includes an option to check if an input is a valid date, and either show a warning to the user but accept the input anyway, or show a warning and reject the input.
You can see it in action here.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论