Project 2013自定义数字字段汇总但排除所有里程碑 [英] Project 2013 Custom Number Field Roll Up but exclude all milestones
问题描述
如果之前已经回答过,我道歉。
If this has been answered before, I apologize.
我在Project 2013中有一个自定义数字字段。我需要在摘要任务中汇总此字段,但不包括任何里程碑字段(类似于完成百分比)。 这似乎是一个简单的直接行动。 但是,我找不到解决方案。
I have a custom number field in Project 2013. I need this field to roll up in the summary task but exclude any milestone fields (similar to % Complete). This seems like a simple straight forward action. However, I can't find a solution.
因此,如果我有4个子任务,其中第4个任务是里程碑,则平均其他3个子任务。
So, if I have 4 sub tasks where the 4th task is the milestone, average the 3 other sub tasks.
我是自定义字段的新手,非常感谢您的帮助。
I'm new to custom fields and would appreciate any help.
谢谢!
推荐答案
sdpierce,
sdpierce,
仅供参考,汇总级别的%完成字段为不是平均值。
Just for reference the % Complete field at summary level is not a roll up average.
为了做我想你想做的事情,这些公式需要至少3个自定义数字字段(例如Number1,Number2,Number3):
In order to do what I think you want, it will take at least 3 custom number fields (e.g. Number1, Number2, Number3) with these formulas:
Number1 = IIf([里程碑],0,{无论您的自定义数字公式}}
Number1=IIf([milestone],0,{whatever your custom number formula})
Number2 = IIf([里程碑],0,1)
Number2=IIf([milestone],0,1)
Number3 = [Number1] / [Number2]
Number3=[Number1]/[Number2]
对于Number1和Number2字段,将汇总值汇总到汇总行。对于Number3字段,请在汇总级别使用公式。
For the Number1 and Number2 fields, roll up a sum value to the summary line. For the Number3 field, use the formula at summary level.
并不像您希望的那样简单。但是,这可以通过一些VBA轻松完成,如下所示(假设您的自定义字段是Number1字段,并且没有任务汇总行的汇总):
Not quite as easy as you had hoped I'm sure. However, this could be readily done with some VBA, as follows (assuming your custom field is the Number1 field and there is no rollup for task summary lines):
Sub AveWithoutMile()
Dim t As任务
Dim st As任务
Dim SumVal As Single
Dim Div As Integer
For Each t In ActiveProject.Tasks
如果t.Summary然后是
For Each st In t.OutlineChildren
如果不是st.Milestone则为
SumVal = SumVal + st.Number1
Div = Div + 1
结束如果
下一页st $
t.Number1 = SumVal / Div
SumVal = 0:Div = 0
结束如果
下一个t
$
End Sub
Sub AveWithoutMile()
Dim t As Task
Dim st As Task
Dim SumVal As Single
Dim Div As Integer
For Each t In ActiveProject.Tasks
If t.Summary Then
For Each st In t.OutlineChildren
If Not st.Milestone Then
SumVal = SumVal + st.Number1
Div = Div + 1
End If
Next st
t.Number1 = SumVal / Div
SumVal = 0: Div = 0
End If
Next t
End Sub
John
这篇关于Project 2013自定义数字字段汇总但排除所有里程碑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!