The DateDiff Excel function is used to calculate the number of frequencies between two dates such as weeks, quarters, years, days etc.
DateDiff( interval, date1, date2, firstdayofweek, firstweekofyear )
Interval = What interval you want to use such as ‘yyyy’ for year, ‘ww’ for weeks etc.
Date1 = The first date
Date2 = The second date
Firstdayofweek = What day is considered the first day of the week. The value is optional and the default value is set at Sunday
Firstweekofyear = You can define the first week based on what you require. For example the default value for the first week is the week in which Jan 1 appears.
Now let’s look at an example. Let’s assume we want to calculate the frequency intervals between two dates based on weeks, days and quarters.