如何确保在Google表格中输入的日期格式为mm/dd/yyyy是有效的?

huangapple go评论89阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年7月3日 13:16:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76601986.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定