Date Calculation Errors (YY|MM|DD)

Newbienew

Active Member
Joined
Mar 17, 2017
Messages
376
Office Version
  1. 2016
Platform
  1. Windows
Good Day all,

Attached is my spread of computing the number of years worked, a computed age calculator, and time away from work. The math is simple as it trickles down to the answers. If the bottom day is more than the top day, it's plus 30 days and the month is minus 1. If the bottom month is more than the top month, then it's plus 12 and the year is minus 1.

My issue is my math isn't mathing, so to say. My formulas are hit and miss, pending what is entered. I will at times get a negative result or be off by 1. My goal is to be absolute in my answers and I am not sure how to do that with the formula I have in each block. If someone could please aid me it would be greatly appreciated.

QA Workbook (click here)
 
I am soo sorry for the delay in reply. I have been extremely overtask at work and a couple of members of my team are pretty ill.
@Alex Blakenburg- I attempted to use the formula but it did not work out for me. The days calculated out to be 6884. I am not sure if this is due to the use of the date hired verse todays date. I want to make sure that each block of the formulas I have works the way they are supposed to get the outcome you have provided.
COMPUTED AGE
TODAY'S DATE000
BIRTHDAY000
SUM TOTAL2549264
PLUS 1 FOR END DATE9265
SUM TOTAL000
MINUS YEARS EMPLOYED000
18106884


I adjusted J14 formula to display the number 4 as it didnt before.

QACHECK.xlsx
GHIJKL
8-1 Year+12 months+30 days
9COMPUTED AGE
10TODAY'S DATE20211642
11BIRTHDAY19961230
12SUM TOTAL25412
13PLUS 1 FOR END DATE13
14SUM TOTAL24413
15MINUS YEARS EMPLOYED630
1618113
Quality Assurance Check Sheet
Cell Formulas
RangeFormula
I10I10=IF(D3<=D2,C2,C2-1)
J10J10=IF(D3>D2,D2+12,IF(D3<=D2,D2,D2-1))-IF(E2<E3,1,)
I11:K11I11=C3
I12,K12I12=I10-C3
J12J12=+J10-D3
K10K10=IF(E2<E3,E2+30,E2)
K13K13=K12+1
I14I14=IF(J14<J15,I12,I12-1)
J14J14=IF(J12<=D6,J12+12,J12)-IF(E6>K14,1,)
K14K14=IF(K15>K13,K13+30,K13)
I15:K15I15=C6
I16I16=(I14-C6)+IF(J16>30,1,)
J16J16=+IF(K16>30,J14-J15+1,J14-J15)
K16K16=IF(K14-K15>30,"0",K14-K15)





@Anthony47 - This section is all hand jammed in, except the today's date. All of this info feeds the other four sections. (Computed age, Time apart from work, years employed). However, I did place your formula in row 16 of C,D, and E and it works perfectly there.
2022512
19961230
2015115
202224
630




Sorry for the double posting.
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I attempted to use the formula but it did not work out for me. The days calculated out to be 6884. I am not sure if this is due to the use of the date hired verse todays date.
That would happen if you didn't increase the start date values in the formula like I had, to allow for what was already accounted for in the Year and Month columns.

In K12 I had:
Rich (BB code):
=DATEDIF(DATE($C$3+$O12,$D$3+$P12,$E$3),DATE($C$2,$D$2,$E$2),"d")

And in K16 I had
Rich (BB code):
=DATEDIF(DATE($C$3+$O16,$D$3+$P16,$E$3),DATE($C$4,$D$4,$E$4),"d")
 
Upvote 0
I copied each one in to the each cell.
QACHECK.xlsx
GHIJKL
8-1 Year+12 months+30 days
9COMPUTED AGE
10TODAY'S DATE20211644
11BIRTHDAY19961230
12SUM TOTAL2549266
13PLUS 1 FOR END DATE9267
14SUM TOTAL2449267
15MINUS YEARS EMPLOYED630
1618106884
Quality Assurance Check Sheet
Cell Formulas
RangeFormula
I10I10=IF(D3<=D2,C2,C2-1)
J10J10=IF(D3>D2,D2+12,IF(D3<=D2,D2,D2-1))-IF(E2<E3,1,)
I11:K11I11=C3
I12I12=DATEDIF(DATE($C$3,$D$3,$E$3),DATE($C$2,$D$2,$E$2),"y")
J12J12=MOD(DATEDIF(DATE($C$3,$D$3,$E$3),DATE($C$2,$D$2,$E$2),"m"),12)
K10K10=IF(E2<E3,E2+30,E2)
K12K12=DATEDIF(DATE($C$3+$O12,$D$3+$P12,$E$3),DATE($C$2,$D$2,$E$2),"d")
K13K13=K12+1
I14I14=IF(J14<J15,I12,I12-1)
J14J14=IF(J12<=D6,J12+12,J12)-IF(E6>K14,1,)
K14K14=IF(K15>K13,K13+30,K13)
I15:K15I15=C6
I16I16=DATEDIF(DATE($C$3,$D$3,$E$3),DATE($C$4,$D$4,$E$4),"y")
J16J16=MOD(DATEDIF(DATE($C$3,$D$3,$E$3),DATE($C$4,$D$4,$E$4),"m"),12)
K16K16=DATEDIF(DATE($C$3+$O16,$D$3+$P16,$E$3),DATE($C$4,$D$4,$E$4),"d")
 
Upvote 0
I had my table in a different position to what was in your spreadsheet.
Try this:

20220511 DateDif etc QACHECK v02 Newbienew.xlsx
GHIJK
8-1 Year+12 months+30 days
9COMPUTED AGE
10TODAY'S DATE20211645
11BIRTHDAY19961230
12SUM TOTAL25415
13PLUS 1 FOR END DATE16
14SUM TOTAL24416
15MINUS YEARS EMPLOYED630
1618106
Sheet1
Cell Formulas
RangeFormula
I10I10=IF(D3<=D2,C2,C2-1)
J10J10=IF(D3>D2,D2+12,IF(D3<=D2,D2,D2-1))-IF(E2<E3,1,)
I11:K11I11=C3
I12I12=DATEDIF(DATE($C$3,$D$3,$E$3),DATE($C$2,$D$2,$E$2),"y")
J12J12=MOD(DATEDIF(DATE($C$3,$D$3,$E$3),DATE($C$2,$D$2,$E$2),"m"),12)
K10K10=IF(E2<E3,E2+30,E2)
K12K12=DATEDIF(DATE($C$3+$I12,$D$3+$J12,$E$3),DATE($C$2,$D$2,$E$2),"d")
K13K13=K12+1
I14I14=IF(J14<J15,I12,I12-1)
J14J14=IF(J12<=D6,J12+12,J12)-IF(E6>K14,1,)
K14K14=IF(K15>K13,K13+30,K13)
I15:K15I15=C6
I16I16=DATEDIF(DATE($C$3,$D$3,$E$3),DATE($C$4,$D$4,$E$4),"y")
J16J16=MOD(DATEDIF(DATE($C$3,$D$3,$E$3),DATE($C$4,$D$4,$E$4),"m"),12)
K16K16=DATEDIF(DATE($C$3+$I16,$D$3+$J16,$E$3),DATE($C$4,$D$4,$E$4),"d")
 
Upvote 0
@Alex Blakenburg I attempted to dabble with your formula this week but I still can't figure out how to make it work with the days. I really wanted to message back with I got it but umm yea.
 
Upvote 0
You did and it still didn't work or you just did and it worked ?
So I updated the link and added comments that I hope to explain better. In the posting above with your formula when you do it by hand the end result should be 19 1 16
My issue is each cell needs to feed the next cells based on the old stack math method.

Each step needs to be shown as I have people above my level that will still do it by hand or occasionally I will do it by hand as I did the one above.

Updated Sheet
 
Upvote 0
It might be because it was so long ago but I am no really understanding what the we are trying to fix. Are we talking about this section below ?
What is not working and what should it show ?
What are you trying to calculate, it seems to be trying to calculate the age at the point of employment using the manually entered employment period on row 6 (which does not seem to be calculated using the hire date) ?

QACHECK-1.xlsx
GHIJK
9COMPUTED AGE
10TODAY'S DATE20221132
11BIRTHDAY1989918
12SUM TOTAL33214
1315
14SUM TOTAL33215
15MINUS YEARS EMPLOYED11013
16COMPUTED AGE2222
Quality Assurance Check Sheet
Cell Formulas
RangeFormula
I10I10=IF(D3<=D2,C2,C2-1)
J10J10=IF(D3>=D2,D2+12,IF(D3<=D2,D2,D2-1))-IF(E2<E3,1,)
I11:K11I11=C3
I12,K12I12=I10-C3
J12J12=+J10-D3
K10K10=IF(E2<E3,E2+30,E2)
K13K13=K12+1
I14I14=IF(J12<J15,I12-1,IF(J14>=J15,I12,""))
J14J14=IF(K13<K15,J12-1,IF(J12<J15,J12+12,J12))
K14K14=IF(K15>K13,K13+30,K13)
I15:K15I15=C6
I16I16=(I14-C6)+IF(J16>30,1,)
J16J16=IF(K16>30,J14-J15+1,ABS(J14-J15))
K16K16=IF(K14-K15>30,"0",K14-K15)
 
Upvote 0

Forum statistics

Threads
1,216,075
Messages
6,128,665
Members
449,462
Latest member
Chislobog

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