0

I have a column where its cells are formatted as "dd hh:mm:ss"

When I'm going to do the totaling of the lines and the number of days "no" exceeds 31, the sum works perfectly, but when the sum of days exceeds 31, Excel considers that we have changed the month and the value of days is reset.

Command:

=SUM(B1:B2)

Result:

           sum of dates                       sum of dates
      "no" exceeded 31 days                 exceeded 31 days

       A         B                        A         B
1            15 00:00:12             1          15 00:00:12
2            16 01:39:48             2          19 01:39:48
             -----------                        -----------
    Total    31 01:40:00                Total   05 01:40:00 ----> here i need it to be "34 01:40:00".

How to make Excel continue summing correctly after days count is greater than 31? ex: 32, 33, 34, 35...

Note:
The cell that will count the total value, which must always be in the format "dd hh:mm:ss" because I will use it in another calculation in my table.

1
  • If you format B1:B3 as numbers, what are the values in each of the cells?
    – Blindspots
    Commented Mar 15, 2023 at 4:51

1 Answer 1

0

Try adding [ ] around the DD, i.e., [DD] for the formatting.

EDIT: Apologies, I'm away from my PC (on a Chromebook at the moment), so I couldn't verify. It seems I mistakenly recalled the similar usage for TIME datatype digits, such as [hh]; however, it seems the d in date data types does not have the equivalent functionality.

Instead, what you can do is use a formula like this:

=text(INT(A3),"#,#00")&" "&TEXT(A3,"hh:mm:ss")

Due to the nature of how Excel processes time, you can treat the number of days as an integer, then concatenate the remainder of the time digits as text. Both of these can be formatted using the TEXT() function.

7
  • The answer is not obvious or verifiable. It may get deleted. You could improve it by giving an example of use, explaining what it does and linking a refetence to its description. Commented Mar 15, 2023 at 7:39
  • I don't have a PC accessible to me at the moment, so if someone can verify that this works for me I'd appreciate it!
    – Arctiic
    Commented Mar 15, 2023 at 8:46
  • @Arctiic I couldn't reproduce your solution... it's too confusing for me! Note: the cell that will contain the total value, which must always be in the format dd hh:mm:ss because I will use it in another calculation in my table.
    – Clamarc
    Commented Mar 16, 2023 at 15:26
  • @Blind Spots when I change the formatting to numbers, the value in decimals 65.07 is correct compared to the amount of days, the problem is that when I change the cell format to "dd hh:mm:ss" Excel ignores it the days value above 31 and it shows "05 01:40:00"!!!
    – Clamarc
    Commented Mar 16, 2023 at 15:49
  • What I'm saying is not to format the date string as "dd" and just leave it as a plain whole integer. The way that Excel stores time makes it so that 24 hours equals "1" anyway, so it will end up displaying the correct number of days even without the date formatting.
    – Arctiic
    Commented Mar 16, 2023 at 17:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .