DateDiff("m", "06/14/1982", "09,01,1982") = 3
A1 = 06/14/1982
A2 = 09/01/1982
=DATEDIF(A1, A2, "m") = 2
If I need DateDiff
to round down like DATEDIF
does, how do I accomplish this?
You can use the Evaluate
function in VBA. However, when working with dates in this manner, you need to ensure that the value being seen by the formula is the number corresponding to the date, and not a VBA Date data type. If the date is stored in a worksheet cell, you would do something like:
Evaluate("DATEDIF(" & [a1].Value2 & "," & [a2].Value2 & ", ""m"")")
If the dates are stored as dates in VBA variables, then:
Evaluate("DATEDIF(" & CDbl(DT1) & "," & CDbl(DT2) & ", ""m"")")
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments