Thread: datediff
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default datediff

The VB DateDiff function requires the earlier date to be placed first and
the later date second... you have them reversed. Try this line in your
function instead...

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

--
Rick (MVP - Excel)


"Mijosuva" wrote in message
...
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