Thread: datediff
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default datediff

DATEDIF() is a worksheet function whereas;

DATEDIFF() function is a VBScript function which should work. The syntax is
DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]]). Try
the below in your immediate window which should return 2 weeks.

DateDiff("w", Date()-14, Date())

If this post helps click Yes
---------------
Jacob Skaria


"Mijosuva" wrote:

Dear Expert

I try to use DateDiff but it doesn't work, when I try to use this simple
function excel say #NAME?

This is what I have

Function session_num(start_date As Date, today_date As Date) As Long


'Determine the # of weeks between today date and Start Date

session_num = DateDiff("ww", today_date, start_date)


End Function