时间公式-下拉选择

Rockee
Rockee
编辑12/09/19 公式和函数

你好,

我搜索过了,时间公式似乎是一场持续不断的增强请求之战。寻求一些帮助,我有两个专栏;'Start Time:'和'End Time:'。在web表单和工作表上有一个下拉框,从上午12:00开始,到晚上11:55结束,所有增量为5分钟。例如12:00 AM, 12:05 AM等等…

我用了一个巨大的公式:

(开始时间:)=如果(1 < > ",INT(((((左(结束时间:1,发现(“:”,结束时间:1)- 1)=“12”,如果(或(找到(“a”,结束时间:1)> 0,找到(“p”,结束时间:1)> 0),0,12),价值(左(结束时间:1,发现(“:”,结束时间:1)- 1)))+如果(找到(“p”,结束时间:1)> 0,12))* 60 +价值(中期(结束时间:1,发现(“:”,结束时间:1)+ 1,2)))((如果(左(开始时间:1,发现(“:”,开始时间:1)- 1)=“12”,如果(或(找到(“a”,开始时间:1)> 0,找到(“p”,开始时间:1)> 0),0,12),值(左(开始时间:1,找到(”:“开始时间:1)- 1)))+(找到(“p”,开始时间:1)> 0,12))* 60 +价值(中期(开始时间:1,发现(“:”,开始时间:1)+ 1,2))))/ 60 ) + ":" + 如果((((((左(结束时间:1,发现(“:”,结束时间:1)- 1)=“12”,如果(或(找到(“a”,结束时间:1)> 0,找到(“p”,结束时间:1)> 0),0,12),价值(左(结束时间:1,发现(“:”,结束时间:1)- 1)))+如果(找到(“p”,结束时间:1)> 0,12))* 60 +价值(中期(结束时间:1,发现(“:”,结束时间:1)+ 1,2)))((如果(左(开始时间:1,发现“:”,开始时间:1)- 1)=“12”,如果(或(找到(“a”,开始时间:1)> 0,找到(“p”,开始时间:1)> 0),0,12),价值(左(开始时间:1,发现(“:”,开始时间:1)- 1)))+(找到(“p”,开始时间:1)> 0,12))* 60 +价值(中期(开始时间:1,发现(“:”,开始时间:1)+ 1,2))))- INT((((如果(左(结束时间:1,发现(“:”,结束时间:1)- 1)=“12”,如果(或(找到(“a”,结束时间:1)> 0,找到(“p”,结束时间:1)> 0),0,12),价值(左(结束时间:1,发现(“:”,结束时间:1)- 1)))+如果(发现(“p”,结束时间:1)> 0,12))* 60 +价值(中期(结束时间:1,发现(“:”,结束时间:1)+ 1,2)))((如果(左(开始时间:1,发现(“:”,开始时间:1)- 1)=“12”,如果(或(找到(“a”,开始时间:1)> 0,找到(“p”,开始时间:1)> 0),0,12),价值(左(开始时间:1,发现(“:”,开始时间:1)- 1)))+如果(找到(“p”,开始时间:1)> 0,12))* 60 +价值(中期(开始时间:1,发现(“:”,开始时间:1)+ 1,2))))/ 60 * 60)< 10,“0”)+(((((左(结束时间:1,发现(“:”,结束时间:1)- 1)=“12”,如果(或(找到(“a”,结束时间:1)> 0,找到(“p”,结束时间:1)> 0),0,12),价值(左(结束时间:1,发现(“:”,结束时间:1)- 1)))+(找到(“p”,结束时间:1)> 0,12))* 60 +价值(中期(结束时间:1,发现(“:”,结束时间:1)+ 1,2)))((如果(左(开始时间:1,发现(“:”,开始时间:1)- 1)=“12”,如果(或(找到(“a”,开始时间:1)> 0,找到(“p”,开始时间:1)> 0),0,12),价值(左(开始时间:1,发现(“:”,开始时间:1)- 1)))+如果找到(“p”,开始时间:1)> 0,12)) * 60 +价值(中期(开始时间:1,发现(“:”,开始时间:1)+ 1,2))))——INT(((((左(结束时间:1,发现(“:”,结束时间:1)- 1)=“12”,如果(或(找到(“a”,结束时间:1)> 0,找到(“p”,结束时间:1)> 0),0,12),价值(左(结束时间:1,发现(“:”,结束时间:1)- 1)))+如果(找到(“p”,结束时间:1)> 0,12))* 60 +价值(中期(结束时间:1,发现(“:”,结束时间:1)+ 1,2)))((如果(左(开始时间:1,发现(“:”,开始时间:1)- 1)=“12”,如果(或(找到(“a”,开始时间:1)> 0,FIND(“p”,开始时间:1)> 0),0,12),价值(左(开始时间:1,发现(“:”,开始时间:1)- 1)))+(找到(“p”,开始时间:1)> 0,12))* 60 +价值(中期(开始时间:1,发现(“:”,开始时间:1)+ 1,2))))/ 60 * 60)," ")

这个工作很好,直到我把它改为上午/下午,因为我的员工正在与军事时间作斗争。有什么建议或改进,我可能错过了搜索?

其次,是否有一种简单的方法将增量转换为分钟的小数?例如:7:05 PM - 10:00 PM转换为2.92?

问候,

Rockee

«1

评论

  • L_123
    L_123 ✭✭✭✭✭✭
    编辑01/24/18

    转换成分钟比输出小时容易得多。

    类似的

    如果(右(Col1 2) =“点”,12 * 60 0)+价值(左(Col1, 2)) * 60 +价值(左(右(Col1, 5), 2)

    是一个数字的分钟数。(假设是两位数的小时数。我不想花时间使用len来正确解析它,您已经展示了您知道如何这样做。)

    用同样的公式得到另一个数的分钟数,然后相减。然后转换回时间。

  • L_123
    L_123 ✭✭✭✭✭✭

    我意识到我只需要解析时间,所以我就这么做了。

    =IF(RIGHT([Start Time] 1,2) = "PM", 60 * 12,0) + (VALUE(LEFT([Start Time]1, VALUE(LEN([Start Time]1) - 6))) * 60) + VALUE(LEFT(RIGHT([Start Time] 1,2), 2)))

  • 谢谢你的回复,卢克。我在“计算”列中尝试了你的公式,它给出了一个错误:#UNPARSEABLE -我将继续摆弄它,看看我是否能让它运行。你可能会认为,在其他平台(Google Sheets和Excel)上如此简单的事情,在Smartsheet上就不需要动脑筋了。

  • L_123
    L_123 ✭✭✭✭✭✭
    编辑01/24/18

    你投入的时间是什么形式的?

    10:15 PM是我用的公式,我刚刚意识到你的公式后面有一个“:”。这可能就是问题所在

  • L_123
    L_123 ✭✭✭✭✭✭
    编辑01/24/18

    试试吧

    =如果(右(结束时间:1,2)=“点”,60 * 12,0)+(值(左(结束时间:1,值(LEN(结束时间:1)- 6)))* 60)+价值(左(右(结束时间:1,5),2))——(如果(右(开始时间:1,2)=“点”,60 * 12,0)+(值(左(开始时间:1,值(LEN(开始时间:1)- 6)))* 60)+价值(左(右(开始时间:1,5),2)))

  • L_123
    L_123 ✭✭✭✭✭✭
    编辑01/24/18

    =ROUND(MinDiff1 / 60) + "H" + (MinDiff1 / 60 - ROUND(MinDiff1 / 60)) * 60 + "M"

    此公式在第1行“MinDiff”列中获取分钟输出,并将其转换为小时和分钟。

    我会使用一个隐藏的助手列发布其他公式到它,引用它,然后隐藏它得到你的号码。

    Lol引起了我的兴趣。我以前做过一次,但忘记了一些。



    编辑:清理了配方@1: 53

  • Rockee
    Rockee
    编辑01/24/18

    这个公式在计算分钟(早上7:25 -晚上9:00)时似乎不太明智。

    =ROUND(MinDiff1 / 60) + "H" + (MinDiff1 / 60 - ROUND(MinDiff1 / 60)) * 60 + "M"

    最后我只取了持续时间;=IF(RIGHT([结束时间:]1,2)= "PM", 60 * 12,0) + (VALUE(LEFT([结束时间:]1)- 6))* 60)+ VALUE(LEFT(RIGHT([结束时间:]1),5),2))- (IF(RIGHT([开始时间:]1,2)= "PM", 60 * 12,0) + (VALUE(LEFT([开始时间:]1)- 6))+ VALUE(LEFT([开始时间:]1)- 6))+ VALUE(LEFT([开始时间:]1),5),2))除以60,这也给了我以小数表示的分钟。我的最后一个问题是弄清楚如果他们在午夜结束工作,因为没有像那样的公式,并把它变成什么时间。

    谢谢你的帮助。

  • L_123
    L_123 ✭✭✭✭✭✭

    我忘了在四舍五入中减去。5来保证四舍五入。我想这应该能解决问题。

    我回到一张旧纸上,对它进行了回顾和编辑。它比这个更深一点,因为它也增加了天数,这可能是你午夜问题的一个选择。(老实说,只需重命名您的列,复制粘贴公式,然后重新命名您的列)这样您就可以跟踪日期和时间。有一个小故障,我还没弄清楚在哪里,在开始和停止之间不到一分钟,它变成了-23H,但我不认为这是一个大问题。如果发生这种情况,我只是使用条件格式使其为空。在智能手机上跟踪任何少于1分钟的事情是没有任何意义的。

    单击复选框,然后保存以刷新行。我有一份个人复印本,所以别担心弄乱了。

    https://app.smartsheet.com/b/publish?EQBCT=dcf71ecb7f184467ab8f5debb68a04da

  • 可怕的路加福音!

    这给了我一些灵感!我做了一些错误检查,然后加入了日期和时间,更改了列名以匹配您的列名,我得到了一个错误- #无效的数据类型。看看我可能错过了什么(附屏幕截图)。

    截屏时间:2018-01-24下午9点16分53秒

    截屏2018-01-24下午9点20分41秒。png

  • L_123
    L_123 ✭✭✭✭✭✭

    你能在回复中发布这个等式吗?另外,检查列属性并确保它是文本而不是日期。

  • 有一个列(Edited)被设置为Date,尽管这不会改变“Minutes”列的输出。

    使用你的公式:

    = (NETDAYS (Input1 Edited1) - 1) *(24 * 60) +如果(右(Edited1 2) =“点”,12 * 60 0)+值(如果(LEN (Edited1) = 17日右(左(Edited1 11), 2),右(左(Edited1, 10), 1))) * 60 +价值(左(右(Edited1, 5), 2))——(如果(右(Input1 2) =“点”,12 * 60 0)+值(如果(LEN (Input1) = 17日右(左(Input1 11), 2),右(左(Input1, 10), 1))) * 60 +价值(左(右(Input1, 5), 2)))

    链接:

    http://publish.smartsheet.com/d95c669fb5c442cda043febc544ae757

  • L_123
    L_123 ✭✭✭✭✭✭

    啊,我脑子出了问题,以为你在计算结束时间。你需要用汽车专栏来计算工作日。如果你看看我的,一个是创建的,另一个是修改的。否则,系统不会识别出该信息是日期。

  • 嗯,有没有办法让它识别日期/时间?您的公式正是我想要实现的,因为我可以将持续时间转换为十进制格式的小时和分钟,而且我更喜欢日期/时间格式。需要注意的是,所有这些都来自一个web表单,数据可能会在一天后输入,这取决于他们工作的时间。

  • L_123
    L_123 ✭✭✭✭✭✭

    我将删除日期修改列,并将其拆分为日期和时间列。你需要稍微修改一下公式。使用日期列,并让他们分别在web表单中输入日期和时间。

  • 谢谢,现在就是这样,我只是隐藏了日期和时间列,以显示使用JOIN函数的一列。

帮助文章参考资料欧宝体育app官方888

想要直接在智能表中练习使用公式吗?

请查看公式手册模板!
@CamSME<\/a> you'll use join and collect with children or decedents as the range. This video might help.<\/p>
\n \n https:\/\/youtu.be\/Dzo0UYjxMmI\n <\/a>\n<\/div>


<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":106286,"type":"question","name":"Health Bubble Turn Colors when Status is Updated","excerpt":"Hello, I am new to Smartsheet. I am trying to get when I change my Status to \"Not Started\" I want the Health bubble to automatically turn grey. And when I change my Status to \"In Progress\" the Health bubble will turn yellow, etc. So far I have: IF(Status1 = \"Not Started\", \"Gray\", \" \"). I want it to change color for each…","categoryID":322,"dateInserted":"2023-06-09T19:29:22+00:00","dateUpdated":"2023-06-09T20:02:36+00:00","dateLastComment":"2023-06-09T21:14:52+00:00","insertUserID":162263,"insertUser":{"userID":162263,"name":"clairehunter","url":"https:\/\/community.smartsheet.com\/profile\/clairehunter","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-10T18:54:18+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":162263,"lastUserID":150413,"lastUser":{"userID":150413,"name":"Kleerfyre","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Kleerfyre","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0FA9VDUULUEH\/n4HMXW6FGST3I.jpg","dateLastActive":"2023-06-09T21:50:34+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":1,"countViews":26,"score":null,"hot":3372684854,"url":"https:\/\/community.smartsheet.com\/discussion\/106286\/health-bubble-turn-colors-when-status-is-updated","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106286\/health-bubble-turn-colors-when-status-is-updated","format":"Rich","tagIDs":[254,440],"lastPost":{"discussionID":106286,"commentID":379933,"name":"Re: Health Bubble Turn Colors when Status is Updated","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/379933#Comment_379933","dateInserted":"2023-06-09T21:14:52+00:00","insertUserID":150413,"insertUser":{"userID":150413,"name":"Kleerfyre","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Kleerfyre","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/0FA9VDUULUEH\/n4HMXW6FGST3I.jpg","dateLastActive":"2023-06-09T21:50:34+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-10T18:54:41+00:00","dateAnswered":"2023-06-09T21:14:52+00:00","acceptedAnswers":[{"commentID":379933,"body":"

You will need a nested IF formula:<\/p>

=IF(Status@row=\"Not Started\", \"Gray\", IF(Status@row=\"In Progress\", \"Yellow\", IF(Status@row=\"Complete\", \"Green\")))<\/p>


<\/p>

Just add more IF Statements like above for what you need. Put all ) at the very end. Then you can turn it into a column formula by right clicking the cell the formula is in and selecting column formula.<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"Formulas","name":"Formulas"},{"tagID":440,"urlcode":"project-management","name":"Project Management"}]},{"discussionID":106265,"type":"question","name":"If Date is blank + past formula","excerpt":"I can't figure out why this would return a \"yes\" when the date cell is blank. =IF([Date of Site Survey (Product)]@row = \" \", \" \", IF(TODAY() > [Date of Site Survey (Product)]@row, \"yes\", \" \")) Intended logic\/result - If date cell is blank, then \"blank\" (this worked when I tried without the 2nd argument added) If date is in…","categoryID":322,"dateInserted":"2023-06-09T14:00:25+00:00","dateUpdated":null,"dateLastComment":"2023-06-09T23:14:36+00:00","insertUserID":162220,"insertUser":{"userID":162220,"name":"dhawkins","title":"Product Manager","url":"https:\/\/community.smartsheet.com\/profile\/dhawkins","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-09T20:05:00+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":45516,"lastUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-06-10T20:34:55+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":3,"countViews":31,"score":null,"hot":3372673501,"url":"https:\/\/community.smartsheet.com\/discussion\/106265\/if-date-is-blank-past-formula","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106265\/if-date-is-blank-past-formula","format":"Rich","lastPost":{"discussionID":106265,"commentID":379953,"name":"Re: If Date is blank + past formula","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/379953#Comment_379953","dateInserted":"2023-06-09T23:14:36+00:00","insertUserID":45516,"insertUser":{"userID":45516,"name":"Paul Newcome","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Paul%20Newcome","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/userpics\/082\/nQPUTVFKKWDJ2.jpg","dateLastActive":"2023-06-10T20:34:55+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-09T14:28:35+00:00","dateAnswered":"2023-06-09T14:12:11+00:00","acceptedAnswers":[{"commentID":379830,"body":"

Try this:<\/p>

=IF([Date of Site Survey (Product)]@row <> \"//www.santa-greenland.com/community/discussion/18316/\", IF(TODAY() > [Date of Site Survey (Product)]@row, \"yes\", \"no\"))<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]}],"title":"Trending in Formulas and Functions ","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

公式和函数趋势