Time representation in excel above 24 hours

后端 未结 2 1602
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-17 17:03

Is there a way to represent a time value in Excel where hours can be 24 and above?

For example, have a time that would be 25:00:00 for 1 AM on the following day (com

相关标签:
2条回答
  • 2021-01-17 17:43

    It's already the case that if you put a date or a time into a cell, you get a datetime value.

    For example, type 14:00 into A1 and A2, and set A3 to =A1+A2. Why does it display 04:00, you might wonder. The answer comes if you set the cell format to something that displays date and time, eg dd/mm/yyyy hh:mm. Do this to A1 and A2 as well and we see:

    • entered pure time values are stored as a datetime with the entered time portion, and a date portion of January 0, 1900
    • doing math on datetimes is possible and becomes comprehensible once you know that zero corresponds to midnight on January 0, 1900, and that one unit = 1 day

    So to do what you want - to store 25 hours in a cell and have it understood by both users and Excel to mean 25 hours - just put a value of 25/24, and a custom format including the magic format code [h], the [] here meaning 'allow the displayed value to go over 24'.

    0 讨论(0)
  • 2021-01-17 17:47

    Are you trying to do math in a spreadsheet? If so, formatting the result of a function as a "Time" can tell you how many hours/days/appropriate units are between two dates. However, you can't then perform functions on these as you usually would. A solution might be to format intermediate values as "numbers," use your functions, and then format the final results as "Time."

    0 讨论(0)
提交回复
热议问题