日期/时间字段,并根据一天中的时间更改时间 [英] Date/Time Field and change time based on time of day

查看:70
本文介绍了日期/时间字段,并根据一天中的时间更改时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Excel中,我有一个日期和时间字段,需要一个公式来查看该字段中的时间.如果时间是从12:00 am到8:00 am,那么在另一个字段中,将时间设为上午8:00,并保留日期.如果时间是其他时间,请同时保留两个时间 和日期.

In Excel, I hava a date and time field and need a formula to look at the time in that field. If the time is 12:00 am to 8:00 am, then, in another field,  make the time 8:00 am and leave the date alone. If the time is any other time, leave both the time and date alone.

这是我到目前为止的公式,但是由于没有任何时间在改变,所以它不起作用:

This is the formula I have so far, but it doesn't work as none of the times are changing:

= IF(AND(C4&=; TIME(24,0,0),C4< = TIME(8,0,0)),TIME(8,0,0),C4)

=IF(AND(C4>=TIME(24,0,0),C4<=TIME(8,0,0)),TIME(8,0,0),C4)

感谢您的帮助!

风帆

推荐答案

风帆,

在函数中您不应该使用0而不是24吗?

In the function shouldn't you use 0 instead of 24?

致谢

Simon


这篇关于日期/时间字段,并根据一天中的时间更改时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆