J
JulieS
Hi Ryan,
Have you tried using the customized formula -- not the VBA code.
For ease of discovery, I've copied John's excellent instructions
below:
-----------------------------------------------------------------------------------
1. Go to Tools/Customize/Fields
2. In the Type selection box, select a spare text field (e.g. Text1)
3. Hit the Formula button
4. Enter the following:
IIf([Duration]<>0,format([Actual
Duration]/[Duration],"#.00%"),"")
5. If you want the same data to appear on summary lines then hit the
option to "Use Formula" for "calculation for task and group summary
rows"
-------------------------------------------------------------------------------
This needs to be done in the Project file. You'll then need to show
the Text field you used for the formula. Choose Insert > Column in
the menu.
I hope this helps. Let us know how you get along.
Julie
Project MVP
Visit http://project.mvps.org/ for the FAQs and additional
information about Microsoft Project
Have you tried using the customized formula -- not the VBA code.
For ease of discovery, I've copied John's excellent instructions
below:
-----------------------------------------------------------------------------------
1. Go to Tools/Customize/Fields
2. In the Type selection box, select a spare text field (e.g. Text1)
3. Hit the Formula button
4. Enter the following:
IIf([Duration]<>0,format([Actual
Duration]/[Duration],"#.00%"),"")
5. If you want the same data to appear on summary lines then hit the
option to "Use Formula" for "calculation for task and group summary
rows"
-------------------------------------------------------------------------------
This needs to be done in the Project file. You'll then need to show
the Text field you used for the formula. Choose Insert > Column in
the menu.
I hope this helps. Let us know how you get along.
Julie
Project MVP
Visit http://project.mvps.org/ for the FAQs and additional
information about Microsoft Project
Ryan said:I've tried and tried to follow your directions to input the
decimals in my
percents, and really this is a case I must follow as its a govt.
contract i
really need to do it. I have mp server, and tried it through
there, but I
can't seem to do it. Is it possible to try explaining it so my
slow self can
understand? Thanks you so much!
John said:Philip said::
Hi Brian,
I noticed this thread of discussion on expressing %
complete in decimals.
Our client has requested for us to report our progress in
decimals. I
tried
to use your VBA code below but I'm not very experienced
with VBA. Could
you
help with step by step instructions? I'm using Project2000.
I presume this is a macro, so I tried to create one and
typed in your
code
in Microsoft Visual Basic Editor. But when I go back to
Tool/Macro its
not
there for me to run it.
Thanks.
Philip,
Brian may or may not be able to address your post immediately
so let me
take a shot.
First of all, Brian gave two versions of code. The first you
WOULD see
if you entered it into the VB Editor and then looed under
Tools/Macro/Macros. The second you will NOT see because it is
a Private
sub. In order to view Private sub, go to the VB Editor and
hit
View/Project Explorer. On the right side of the screen you
should see
the explorer hierarchy with something that says, "VBAProject
(your
project name)". Under that you will see, "Microsoft Project
Objects" and
under that you will see, "ThisProject(your project name)". If
you double
click the latter, the macro code will appear in the code
window on the
left side of the screen.
The second version of Brian's code is designed to run
automatically so
you don't have to initiate it. However it does have a
potential glitch
that should be addressed. If any tasks in the schedule are
milestones
(i.e. "0" duration) an error will be generated because the
format
formula is trying to divide by zero and in this galaxy,
that's a no-no
although I think it may be OK in the Pegasus galaxy - I'll
have to check
with Sam or Rodney. At any rate, the corrected code is shown
below.
Private Sub Project_Change(ByVal pj As Project)
Dim t As Task
For Each t In ActiveProject.Tasks
If Not t Is Nothing And t.Duration <> 0 Then
t.Text1 = Format(t.ActualDuration / t.Duration,
"#.00%")
End If
Next t
End Sub
However, all of the above may be useful information but there
is an
easier approach. VBA is not necessary to do what you want. A
simple
formula in a custom field will do the trick whether you
simply want a
decimal value or a decimal percent value. To set up a
formula, do the
following:
1. Go to Tools/Customize/Fields
2. In the Type selection box, select a spare text field (e.g.
Text1)
3. Hit the Formula button
4. Enter the following:
IIf([Duration]<>0,format([Actual
Duration]/[Duration],"#.00"),"")
If you want a decimal percent value the formula would be:
IIf([Duration]<>0,format([Actual
Duration]/[Duration],"#.00%"),"")
5. If you want the same data to appear on summary lines then
hit the
option to "Use Formula" for "calculation for task and group
summary rows"
That's it, you should be all set.
Just for reference, I agree 100% with Brian. If someone is
trying to
show percent complete to multiple decimal places then they
are way too
far into the detail.
Hope this helps.
John
Project MVP
Hi John,
Inputting the formula in Customize Fields worked wonderfully.
Thank you.
Philip.
Philip,
You're welcome.
John