是否可以根据时间值来使用Excel函数来给出值?

发布于 2025-02-11 18:19:31 字数 690 浏览 2 评论 0原文

我正在寻找一个我可以使用的功能,如果节目的时间为晚上11点至5:59 AM,则可以返回“夜晚”,如果它在上午6点至5:59 PM和“ Prime)之间,则可以使用“ Prime Day Off Prime” “如果下午6点至晚上10:59。

我尝试使用IFS函数在代码为=(或(g3> = 23,g3< 6),“夜晚”或(g3> = 6,g3< 18),“ day off prime”)中,“夜晚” ,或(g3> = 18,g3,23),“ prime”)

g列只是其所打开的小时的HH格式,值格式为数字。

我也尝试过= ifs(或(bk3> = 23:00,bk3< 06:00),“夜晚off prime”或(bk3> = 06:00,g3< 18:00),“ off Prime的一天“或(bk3> = 18:00,bk3,23:00),“ prime”)

这里的bk列是程序在HH:MM时间格式中的时间,

我发现的主要麻烦是如何在两个不同时间之间标记时间,例如上午11点至5:59,而不是仅仅在晚上11点以上。我使用了或逻辑,但这似乎没有用。

我还尝试了一个vlookup函数= vlookup(bk2,$ ac $ 899:$ ad $ 901,2,

true -17:59

AC901 Prime AD901 18:00-22:59

I'm looking for a function I can use that returns "Night Off Prime" if the time a programme was on was between 11pm - 5:59am, "Day Off Prime" if it was on between 6am - 5:59pm and "Prime" if it was on between 6pm - 10:59pm.

I've tried using the IFS function with the code being =IFS(OR(G3>=23,G3<6),"Night Off Prime", OR(G3>=6,G3<18),"Day Off Prime", OR(G3>=18,G3,23),"Prime")

The G column is just the hh format of the hour it was on, with the values formatted as Number.

I've also tried =IFS(OR(BK3>=23:00,BK3<06:00),"Night Off Prime", OR(BK3>=06:00,G3<18:00),"Day Off Prime", OR(BK3>=18:00,BK3,23:00),"Prime")

Here the BK column is the time the programme was on in the hh:mm time format

The main trouble I'm finding there is how to label time between two different times such as between 11pm - 5:59am instead of just past 11pm. I used the OR logical but that doesn't seem to have worked.

I've also tried a VLOOKUP function =VLOOKUP(BK2,$AC$899:$AD$901,2, TRUE)

Here the table array is

AC899 Night Off Prime AD899 23:00-05:59

AC900 Day Off Prime AD900 06:00-17:59

AC901 Prime AD901 18:00-22:59

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

胡渣熟男 2025-02-18 18:19:31

如果您喜欢IFS,则可能需要这样调整(也应该以类似的方式使用HH:MM)

=IFS(G3<6;"Night Off Prime";G3<18;"Day Off Prime";G3<23;"Prime";TRUE;"Night Off Prime")

:设置)

另外:

=IFS(G3<0;"#N/A";G3<6;"Night Off Prime";G3<18;"Day Off Prime";G3<23;"Prime";G3<24;"Night Off Prime";TRUE;"#N/A")

If you prefer the IFS you may want to adjust like this (should work in the similar way for hh:mm as well):

=IFS(G3<6;"Night Off Prime";G3<18;"Day Off Prime";G3<23;"Prime";TRUE;"Night Off Prime")

(may replace ; with , depending on regional setting)

alternatively:

=IFS(G3<0;"#N/A";G3<6;"Night Off Prime";G3<18;"Day Off Prime";G3<23;"Prime";G3<24;"Night Off Prime";TRUE;"#N/A")
请恋爱 2025-02-18 18:19:31

“我发现的主要麻烦是如何在两个不同时间之间标记时间,例如上午11点至5:59,而不是仅仅是晚上11点。”

添加一个列H2 = G2 + 1/24
然后,您的范围为0至7/24、7/24至19/24和19/24至24/24,因此您没有将时钟重置为零的间隔分开。

"The main trouble I'm finding there is how to label time between two different times such as between 11pm - 5:59am instead of just past 11pm."

Add a column H2 = G2 + 1/24
Then your ranges are 0 to 7/24, 7/24 to 19/24 and 19/24 to 24/24, so you don't have an interval split over a resetting of the clock to zero.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文