Sum fields if they meet a criteria

Hello,I am still fairly new to Notes devel and am creating a prodution log on a form. The form has over 30 fields were the users will put in the amount of minutes they spent on each action. Some of these entries will count as productive time and some will count as non-productive time. I want to be able to create a field that sums the productive time fields and one that sums the non productive times. Since I will be adding fields periodically I dont want to have to add each fieldname in the formula. I was thinking of putting something like a 1 at the beggining of the field name for the productive time fields and a 2 for the non productive time fields. Can use a wild card to have the sum formula total all fields that start with a 1 and then all fields that start with a 2?

Subject: Fields can not start with a number, but…

PTime = Cdbl(0)	NPTime = Cdbl(0)

Forall item1 In NotesDocument.Items

	If Left(item1.Name, 2) = "P1" Then

		PTime = PTime + item.Values(0)

	Elseif Left(item1.Name, 2) = "N1" Then

		NPTime = NPTime + item.Values(0)

	End If

End Forall

NotesDocument.ProductiveTime = PTime

NotesDocument.NonProductiveTime = NPTime

Subject: RE: Fields can not start with a number, but…

So I would just put this script in my computed field?

I tried that and it doesn’t work.