• 510K Members
• 8,818 Online
• 607K Conversations
SOLVED

## Different results from DatedIf and DateDiff functions

Highlighted
Occasional Contributor

# Different results from DatedIf and DateDiff functions

I was trying to find out the difference between two dates (10-06-1985 and 01-06-2019) using these functions. DatedIf Function returned the result 33 and DateDiff function in VBA returned 34

I thought both functions are the same. Can anyone here tell me why this difference?

3 Replies
Solution

# Re: Different results from DatedIf and DateDiff functions

@Ajay_Anand , IMHO, they have different logic.

DateDif calculates complete years, months, etc. Actually for your sample it'll be 33 years 11 months and some days, return for years is 33.

DateDiff checks if you over the year, month, etc.

For more simple example, if start date 30 Dec 2018 and end date 10 Jan 2019 when

DateDif returns 0 years (0 years 0 months 11 days)

DateDiff returns 1 year (you are over year 2018)

# Re: Different results from DatedIf and DateDiff functions

@Sergei Baklan Thanks for that reply.

Is there any function in VBA which equivalent to DatedIf function?

# Re: Different results from DatedIf and DateDiff functions

@Ajay_Anand , I don't think so. People suggest to evaluate DateDif https://stackoverflow.com/questions/35397822/datedif-function-in-vba, but I didn't play with that.

Related Conversations
Help with an IF AND formula
aanaya6 in Excel on
3 Replies
IF FUNCTION ISN'T WORKING NO MATTER HOW SIMPLE THE COMMAND IS
thomasea in Excel on
6 Replies
Returning list from 3D array
Paul Danaher in Excel on
17 Replies
User Defined Function not showing with up "="
katrina bethea in Excel on
5 Replies