Format numbers to read "? Days and ? Hours"

AndyTampa

Board Regular
Joined
Aug 14, 2011
Messages
196
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a set of numbers after calculating a start date and end date. I create a pivot table of these numbers, but I need them to read in Days and Hours instead of some decimal. The data from the pivot table will be used to make a chart.

This means I cannot use a formula to concatenate the number into text because the chart won't display the data bars correctly, if at all. In formatting cells, I can make 33.34 read as 33.34 Days or 800 Hours, but I can't find a way to make it read "33 Days 8 Hours".

I've used d" Days "h" Hours" which works until you get over 30 days. Excel 2010 will not accept [d]" Days "h" Hours" or #" Days "h" Hours". Am I missing something?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
=INT(A1) &" Days, " &INT(MOD(A1,1)*24) &" Hours"

If you want the minutes, you would have to mod the remainder of the hours etc
 
Upvote 0
That is a formula which won't work in a bar graph nor can 'x' number of items be averaged on that. I need to format a number to read Days and Hours.
 
Upvote 0
Is there a way to calculate within a custom cell format?
 
Upvote 0

Forum statistics

Threads
1,215,429
Messages
6,124,841
Members
449,193
Latest member
MikeVol

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