I wanted to divide a trip's departure time into 4 separate "times of day" in Excel (Morning, afternoon, evening, Night)
This script is mine, and the start time column contains the time (hh:mm:ss)
=IF(
    AND([@[start_time]] >= TIME(20,0,0),
        [@[start_time]] <= TIME(23,59,59)
    ),
    "Night",
    IF(
        AND([@[start_time]] >= TIME(0,0,0),
            [@[start_time]] < TIME(6,0,0)
        ),
        "Night",
        IF(
            AND([@[start_time]] >= TIME(6,0,0),
                [@[start_time]] < TIME(12,0,0)
            ),
            "Morning",
            IF(
                AND([@[start_time]] >= TIME(12,0,0),
                    [@[start_time]] < TIME(16,0,0)
                ),
                "Afternoon",
                "Evening"
            )
        )
    )
)
I was wondering if there is any way to improve this function or make it easier.