Calculate duration

T

Tonco

Hi all,

I have a project concerning translations. Every resource has an average
amount of words he/she can translate per day.

Would it be possible to have a custom task field (number) that holds the
total number of words for a task and let the duration of the task be
calculated based on for example a custom resource field (number) that holds
the average number of words he can translater per day?

I hope someone can help me in the proper direction. Thanks a zillion in
advance!
 
J

John

Tonco said:
Hi all,

I have a project concerning translations. Every resource has an average
amount of words he/she can translate per day.

Would it be possible to have a custom task field (number) that holds the
total number of words for a task and let the duration of the task be
calculated based on for example a custom resource field (number) that holds
the average number of words he can translater per day?

I hope someone can help me in the proper direction. Thanks a zillion in
advance!

Tonco,
Yes but it is better done using VBA than through formulas. The problem
with using a formula in this case is that standard fields (i.e. Task
Name, Duration, Start, Finish, etc.) cannot [simply] be modified with a
formula. I say "simply" because formulas only calculate values in spare
fields (i.e. NumberN, TextN, CostN, etc.) although through the use of
Paste Linking, standard fields can be modified from the formula, -
however this is not a recommended practice (stability issues).

The following simple VBA macro would be a better bet. It assumes there
is only one resource assigned to each task. If more than one resource is
assigned, the code can be modified however some type of algorithm will
be needed to define whether the translations are concurrent (i.e. one
resource translates one section while another resource translates
another section), or serial (e.g. the second resource needs some of the
information obtained by the first resource's translation).

Sub WdsPerDay()
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
For Each a In t.Assignments
t.Duration = t.Number1 * _
ActiveProject.Resources(t.ResourceNames).Number1
Next a
End If
Next t
End Sub

Hope this helps.
John
Project MVP
 
T

Tonco

Hi John, this answer helps me a very great part in the proper direction. I
think I indeed best choose for the VBA solution. I'm not new to VBA, however
new to VBA in Project, so I'm not sure yet how to trigger the sub. I'll try
to find out, but a hint is
always welcome... ;)

Thanks for all the efforts so far!

Best regards, Tonco

John said:
Tonco said:
Hi all,

I have a project concerning translations. Every resource has an average
amount of words he/she can translate per day.

Would it be possible to have a custom task field (number) that holds the
total number of words for a task and let the duration of the task be
calculated based on for example a custom resource field (number) that holds
the average number of words he can translater per day?

I hope someone can help me in the proper direction. Thanks a zillion in
advance!

Tonco,
Yes but it is better done using VBA than through formulas. The problem
with using a formula in this case is that standard fields (i.e. Task
Name, Duration, Start, Finish, etc.) cannot [simply] be modified with a
formula. I say "simply" because formulas only calculate values in spare
fields (i.e. NumberN, TextN, CostN, etc.) although through the use of
Paste Linking, standard fields can be modified from the formula, -
however this is not a recommended practice (stability issues).

The following simple VBA macro would be a better bet. It assumes there
is only one resource assigned to each task. If more than one resource is
assigned, the code can be modified however some type of algorithm will
be needed to define whether the translations are concurrent (i.e. one
resource translates one section while another resource translates
another section), or serial (e.g. the second resource needs some of the
information obtained by the first resource's translation).

Sub WdsPerDay()
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
For Each a In t.Assignments
t.Duration = t.Number1 * _
ActiveProject.Resources(t.ResourceNames).Number1
Next a
End If
Next t
End Sub

Hope this helps.
John
Project MVP
 
J

John

Tonco said:
Hi John, this answer helps me a very great part in the proper direction. I
think I indeed best choose for the VBA solution. I'm not new to VBA, however
new to VBA in Project, so I'm not sure yet how to trigger the sub. I'll try
to find out, but a hint is
always welcome... ;)

Thanks for all the efforts so far!

Best regards, Tonco
Tonco,
I don't have Project open at the moment so this is from memory, but it
should get you headed in the right direction.
1. Go to Tools/Macro/Visual Basic Editor
2. The editor window will open for you to enter code. If I recall
correctly, the code will be part of the active project (which may or may
not be the default blank project)
3. Copy and paste the code I provided into the code window
4. If the file you want to run it on is the active project, go to
Run/Run Macro
5. If the file you want to run it on is NOT the active project, it will
be easier to load the new macro into your Global
a. From Project go to Tools/Organizer/Modules tab
b. In the right selection list you will see the module that contains
the code you just entered
c. Select that module and hit Copy. That will put the code into your
Global so you can run it on any file
6. Once the macro is in your Global all you have to do to run it is to
go to Tools/Macro/Macros and select the WdsPerDay macro and hit "Run".

Hope this helps.
John
Project MVP
 
T

Tonco

John,

Thanks again for guiding me on this subject. It was most helpful and it's up
and running now!

Best regards,

Tonco
 
J

John

Tonco said:
John,

Thanks again for guiding me on this subject. It was most helpful and it's up
and running now!

Best regards,

Tonco

Tonco,
You're welcome. That's why we are here.

John
Project MVP
 

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