=TEXT(D1-D2,"d+h+m") not working over a month

Status
Not open for further replies.

bowlesj

New Member
Joined
Aug 28, 2011
Messages
26
Hi,

The formula in the subject line is giving the wrong number of days when the span of time is over a month.

My attached picture contains two snapshots.
  • The first snapshot shows my highlighting the formula in the subject line so you can see it in the formula bar. Here the days is the extra days across a month (4 days rather than the number of actual days).
  • The second snapshot shows where I copied the set of cells down and I changed the formula to include the month. This is the revised formula
    VBA Code:
    =TEXT(D6-D7,"m+d+h+m") & " Months + Days + Hours + Minutes since extraction."
    . Again I highlighted it so you can see it in the formula bar. Here the months is incorrect. It should be 1 month.
How might I get the actual total days? Once I have that I can figure out the weeks. Actually "W+D+H+M" would be best if that is possible. I tried "w+d+h+m" and that just showed "w+4+7+3".

Thanks,
John
 

Attachments

  • Excel_Issue.png
    Excel_Issue.png
    35.2 KB · Views: 9

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Status
Not open for further replies.

Forum statistics

Threads
1,215,465
Messages
6,124,978
Members
449,200
Latest member
Jamil ahmed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top