Calculating Years, Months, Days, Hours, Minutes for Work Days/Hour from Minutes

LWLD

New Member
Joined
Apr 22, 2022
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Good day all,

I am hoping to get some help with a formulae. I recently got help with another problem, and I am hoping y'all can help with this one also. I have managed to find formulae online which allow me to calculate YMWDHMs from a large number of minutes, however, I cannot seem to find anything which would help me tweak the formula to report back in the same format when considering a working day is 8 hours, and a working week is 5 days. Can anyone help with this specific issue? And to add to this, I would also like the result to ignore the specific units when there is a zero value.

This started out as something I figured was going to be relatively simple and has mutated into the foul spawn of something wretched and putrid.

Any assistance would be gratefully received.

Thanks

As you can see from the table H7 is returning a value of just over 6 years, however, with a working day and week, this should be much higher. I have a couple of helper rows L and M, though, it's been so long since I worked on this sheet, I can no longer remember the exact reason for each.

Cell Formulas
RangeFormula
G3:G16G3=ROUNDUP(IFERROR(60/E3,0),2)&" seconds"
H3:I16H3=IF(INT(L3)*FLOOR(12*MOD(L3,1),1)=0,"",INT(L3)&" Years ")&IF(FLOOR(12*MOD(L3,1),1)=0,"",FLOOR(12*MOD(L3,1),1)&" Months ")&IF(FLOOR(30.5*MOD(L3*12,1),1)=0,"",FLOOR(30.5*MOD(L3*12,1),1)&" Days ")&TEXT(MOD(L3*12*30.5,1),"h"" hours ""m"" minute(s) """)
L3:L16L3=(A3*B3*C3*D3*F3)/525600
M3:M16M3=A3*B3*D3*0.5/525600
E3:E16E3=A3*B3*C3*D3
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I just find it easier to create helper columns, it's much easier to read and manage. I created a tale for the conventional calculated time. See what you think

Work Week Calc.xlsm
ABCDEFGHIJKLMNOPQ
1Work Week/Hour CalculatorSeconds per Unit:31536000262800060480086400360060
2YrMnthWkDayHrMin
3№ of Samples№ of Sides№ of FM per Side№ of Imaging Combinations№ of FM ImagesTotal Time per FM (Conventional)Total Time per FM (New)Total Sample Time (Conventional)Total Sample Time (New)Total Conventional SecondsYrsMnthsWksDaysHrsMins
4122521001 minute(s)0.6 seconds1 Min0 hours 0 minute(s)100000001
552832402 minute(s)0.25 seconds8 Mins0 hours 0 minute(s)480000008
63142245 minute(s)2.5 seconds2 Mins0 hours 0 minute(s)120000002
7122622882 minute(s)0.21 seconds9 Mins0 hours 0 minute(s)576000009
8100,00024216000002 minute(s)0.01 seconds1 Mnth, , 6 Days, 14 Hrs, 53 Mins0 hours 0 minute(s)3,200,00001061453
95,000,000242800000003 minute(s)0.01 seconds7 Yrs, 7 Mnths, 1 Wk, 2 Days, 20 Hrs, 40 Mins0 hours 0 minute(s)240,000,00077122040
1000 seconds 0 hours 0 minute(s)0000000
1100 seconds 0 hours 0 minute(s)0000000
1200 seconds 0 hours 0 minute(s)0000000
1300 seconds 0 hours 0 minute(s)0000000
1400 seconds 0 hours 0 minute(s)0000000
1500 seconds 0 hours 0 minute(s)0000000
1600 seconds 0 hours 0 minute(s)0000000
1700 seconds 0 hours 0 minute(s)0000000
Sheet2
Cell Formulas
RangeFormula
L1L1=60*60*24*365
M1M1=L1/12
N1N1=60*60*24*7
O1O1=60*60*24
P1P1=60*60
G4:G17G4=ROUNDUP(IFERROR(60/E4,0),2)&" seconds"
H4:H17H4=IFS(L4>1,L4&L$3,L4=1,L4&L$2,L4=0,"")&IF(SUM($L4:L4)>0,", ","")&IFS(M4>1,M4&M$3,M4=1,M4&M$2,M4=0,"")&IF(SUM($L4:M4)>0,", ","")&IFS(N4>1,N4&N$3,N4=1,N4&N$2,N4=0,"")&IF(SUM($L4:N4)>0,", ","")&IFS(O4>1,O4&O$3,O4=1,O4&O$2,O4=0,"")&IF(SUM($L4:O4)>0,", ","")&IFS(P4>1,P4&P$3,P4=1,P4&P$2,P4=0,"")&IF(SUM($L4:P4)>0,", ","")&IFS(Q4>1,Q4&Q$3,Q4=1,Q4&Q$2,Q4=0,"")
I4:I17I4=IF(INT(M4)*FLOOR(12*MOD(M4,1),1)=0,"",INT(M4)&" Years ")&IF(FLOOR(12*MOD(M4,1),1)=0,"",FLOOR(12*MOD(M4,1),1)&" Months ")&IF(FLOOR(30.5*MOD(M4*12,1),1)=0,"",FLOOR(30.5*MOD(M4*12,1),1)&" Days ")&TEXT(MOD(M4*12*30.5,1),"h"" hours ""m"" minute(s) """)
K4:K17K4=E4*F4
L4:L17L4=INT($K4/L$1)
M4:Q17M4=INT(($K4-SUMPRODUCT($L$1:L$1,$L4:L4))/M$1)
E4:E17E4=A4*B4*C4*D4
 
Upvote 0
Solution
Good day @Jeffrey Mahoney, thanks for the input. The problem seems to be that these are not accounting for a work week (40 hours) and a work week (5 days).

In my table, H& comes out at just over 6 years, however, this is if we were calculating at 24 hours a day 7 days a week. Where in reality, it should be around 3 times as long, if not more.

I'll try out your formulae and see what's what.

Thanks again.
 
Upvote 0
Change the number of seconds for each period in the top row of the helper table
 
Upvote 0
Hi, @Jeffrey Mahoney, I managed to get those changed and working. Thanks. I tried to use the same formulae (row H) for row I, but can't seem to get anything other than zeroes across the board. Is a roundup required somewhere?
 
Upvote 0
I don't know about getting zeros because the table I posted shows proper values. Make sure all the supporting values in columns A-F are real numbers, not text. For instance, column F has values that are number formatted to look like 1 Minute or 12 minutes, but in fact they are whole integers. Make sure you put all the formulas I provided in the right columns. If they were inserted into the wrong column and then you deleted a column afterward so that it showed the same column as I, then things are not going to work.
 
Upvote 0
On the back of this, I'm trying to calculate the difference between the two time-frames and although some work, some are returning negative values, how would I address this. I've included the helper tables I am using.

Work Hours Calculator - Copy.xlsx
KLMNOPQRSTUVWXYZAAABACADAEAFAG
1Seconds per Unit691200057600014400028800360060Seconds per Unit691200057600014400028800360060
2 Year(s) Month(s) Week(s) Day(s) Hour(s) Min(s) Year(s) Month(s) Week(s) Day(s) Hour(s) Min(s)
3Total Conventional Seconds Year(s) Month(s) Week(s) Day(s) Hour(s) Min(s)Total New Seconds Year(s) Month(s) Week(s) Day(s) Hour(s) Min(s) Year(s) Month(s) Week(s) Day(s) Hour(s) Min(s)
4120000000320240.000000040000316
5288000001001800.000000030-1-1-10-130
67200000020360.00000006-1-1-1-1154
73456000011362880.000000048-1-1-10048
81920000002791152024000000.00352324021112240
AARI Calculator
Cell Formulas
RangeFormula
L1,T1L1=60*60*8*5*4*12
M1,U1M1=60*60*8*5*4
N1,V1N1=60*60*8*5
O1,W1O1=60*60*8
P1,X1P1=60*60
K4:K8K4=E4*F4*60
L4:L8L4=INT($K4/L$1)
M4:Q8M4=INT(($K4-SUMPRODUCT($L$1:L$1,$L4:L4))/M$1)
S4:S8S4=ROUNDUP(IFERROR(A4*B4*D4*60,0),2)
T4:T8T4=INT($S4/T$1)
U4:Y8U4=INT(($S4-SUMPRODUCT($T$1:T$1,$T4:T4))/U$1)
AB4:AB8AB4=L4-T4+INT((M4-U4)/12)+INT((N4-V4)/4)+INT((O4-W4)/5)+INT((P4-X4)/8)+INT((Q4-Y4)/60)
AC4:AC8AC4=MOD(M4-U4,12)+INT((N4-V4)/4)+INT((O4-W4)/5)+INT((P4-X4)/8)+INT((Q4-Y4)/60)
AD4:AD8AD4=MOD(N4-V4,4)+INT((O4-W4)/5)+INT((P4-X4)/8)+INT((Q4-Y4)/60)
AE4:AE8AE4=MOD(O4-W4,5)+INT((P4-X4)/8)+INT((Q4-Y4)/60)
AF4:AF8AF4=MOD(P4-X4,8)+INT((Q4-Y4)/60)
AG4:AG8AG4=MOD(Q4-Y4,60)
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

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