Date has caused DATEDIF based formula to be incorrect

chive90

Board Regular
Joined
May 3, 2023
Messages
56
Office Version
  1. 2016
C5 = Yearly salary figure
C12 = Salary left to be paid 23/24 FY figure

E18 = First salary payment date (30/04/23)
E19 = Last salary payment date (31/03/24)

Formula in cell C12 = =C5/DATEDIF(E18,EOMONTH(E19,1),"m")*(DATEDIF(E18,EOMONTH(E19,1),"m")-(MONTH(TODAY())-MONTH(E18)))

This was working fine, up until this month, when it appears to now have wildly inflated the figure. Possibly something to do with the new calendar year?

Based on the date value in E19, there are 3 salary payments left this FY, yet the figure in C12 is much, much more than that.

Any ideas?

Thanks
 
With a negative number you keep adding the Modulus (in this case 12) until it reaches a positive number i.e. -3 + 12 = 9

For example -11 mod 7 would be -11 + 7 + 7 = 3

a - b*INT(a/b) is what is actually used by Excel for calculating Mod(a, b), so with the -3 and 12
Book1
F
26-3
2712
28
299
Sheet1
Cell Formulas
RangeFormula
F29F29=F26-F27*INT(F26/F27)
It would appear to be the same with negative when the divisor is negative, as shown by the third example in my link.
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,619
Latest member
Shiv1198

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