Google 张:Returns "False" 如果时间在 23:00 到 05:00 范围内(或从 11:00 下午到 05:00 是)

Google sheets: Returns "False" if the time is in the range from 23:00 to 05:00 (or from 11:00 PM to 05:00 AM)

我的公式应该 return 4 个不同的 文本值,具体取决于单元格中的时间值

一切正常,但是每次我尝试让公式查看从23:00到[=的时间24=]05:00,如果在完整的公式。我尝试了 12 小时格式,但它的工作方式相同。

=IFS(
AND(TEXT(C18,"HH:MM")>="05:00",TEXT(C18,"HH:MM")<="10:59"),"SS",
AND(TEXT(C18,"HH:MM")>="11:00",TEXT(C18,"HH:MM")<="16:59"),"AA",
AND(TEXT(C18,"HH:MM")>="17:00",TEXT(C18,"HH:MM")<="22:59"),"MM",
AND(TEXT(C18,"HH:MM")>="23:00",TEXT(C18,"HH:MM")<="04:59"),"LL")

最后一行外,此公式中的所有内容都正确。而不是 LL# N/A returns。我不明白为什么会这样。

更新后的答案:

由于您涵盖了当天的 完整 时间范围,如果 IFS 的 return 值为 NA,则表示没有匹配项。在这种情况下,return LL:

=ifna(IFS(
AND(TEXT(C18,"HH:MM")>="05:00",TEXT(C18,"HH:MM")<="10:59"),"SS",
AND(TEXT(C18,"HH:MM")>="11:00",TEXT(C18,"HH:MM")<="16:59"),"AA",
AND(TEXT(C18,"HH:MM")>="17:00",TEXT(C18,"HH:MM")<="22:59"),"MM"),"LL")

尝试:

=IFS(
 (TEXT(C18, "HH:MM")>="05:00")*(TEXT(C18, "HH:MM")<="10:59"), "SS",
 (TEXT(C18, "HH:MM")>="11:00")*(TEXT(C18, "HH:MM")<="16:59"), "AA",
 (TEXT(C18, "HH:MM")>="17:00")*(TEXT(C18, "HH:MM")<="22:59"), "MM",
((TEXT(C18, "HH:MM")>="23:00")*(TEXT(C18, "HH:MM")<="23:59"))+
((TEXT(C18, "HH:MM")>="00:00")*(TEXT(C18, "HH:MM")<="04:59")), "LL")

尝试:

=VLOOKUP(C18, {
 0,              "LL"; 
 VALUE("5:00"),  "SS";
 VALUE("11:00"), "AA";
 VALUE("17:00"), "MM";
 VALUE("23:00"), "LL"}, 2, 1)

或:

=VLOOKUP(TIMEVALUE(C18), {
 TIMEVALUE("00:00"), "LL"; 
 TIMEVALUE("05:00"), "SS";
 TIMEVALUE("11:00"), "AA";
 TIMEVALUE("17:00"), "MM";
 TIMEVALUE("23:00"), "LL"}, 2, 1)