PLEASE HELP...DateDiff problem

M

Macrofinder

I am trying to apply a DateDiff Function to Duration2, by comparing Finish to
Finish4 and applying my task calendar. Here is my formula. So far it is
returning .03, .58, etc. I read about DateDiff returning answers in minutes,
but I am unsure of how to convert. Please see attached formula. What am I
doing wrong? I need the formula to compare days, not minutes. Thank you in
advance.

Sub DateDiff()

Duration2 = (DateDiff(Finish, Finish4, TaskCalendar))

End Sub
 
C

Chak

Hi

Try this:

Duration2 = DateDiff("d", Finish, Finish4)

I am not sure what TaskCalendar is for. I thought atleast you can get
the date difference in days by doing this.

Thanks
Chak
 
M

Macrofinder

I tried the command below, however this does not work. I tried customizing
the duration2 field and writing a macro using every method possible. I feel
as if I am missing something else. I was using the "task calendar" because I
have multiple working calendars applied in my schedule. I would like to see
the DateDiff in total # of working days.

Thank you for your help, however it does not seem to work.
 
R

Ray McCoppin

Using Project VBA to get the date diffence betweeen two date taking into
account a calendar use "DateDifference(StartDate, FinishDate, [Calendar])"

In a custom field using a formula Project use "ProjDateDiff( date1, date2,
calendar )"

Hope this helps
 
M

Macrofinder

Hi Ray...

I initially tried the ProjDateDiff first, but after further review I found
that there is no work around for ProjDateDiff figuring the difference down to
the minute. I was able to use DateDiff and just multiplying by 480 (for an 8
hour shift). It's not ideal, but it does the trick.

Thank you for your input.

Ray McCoppin said:
Using Project VBA to get the date diffence betweeen two date taking into
account a calendar use "DateDifference(StartDate, FinishDate, [Calendar])"

In a custom field using a formula Project use "ProjDateDiff( date1, date2,
calendar )"

Hope this helps
--
Ray McCoppin

http://www.randsmanagement.com
SRS gantt charts


Macrofinder said:
I tried the command below, however this does not work. I tried customizing
the duration2 field and writing a macro using every method possible. I feel
as if I am missing something else. I was using the "task calendar" because I
have multiple working calendars applied in my schedule. I would like to see
the DateDiff in total # of working days.

Thank you for your help, however it does not seem to work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top