AnsweredAssumed Answered

Sumif based on 2 fields

Question asked by pdegior on May 30, 2012
Latest reply on Aug 28, 2012 by iceknight

Title

Sumif based on 2 fields

Post

I have two tables that are linked by ProjNum field.  The second table is a time log that users can enter hours and select a department from a drop down.  The intent is to track hours on a project.  I have a field in my main Project table called ActLabHrs.  I want to populate that field based on the sum of all the hours worked for a specific project for Labor only.  I will have a field in my main project table for each discipline ie: ActLabHrs, ActEngHrs etc.

I am having trouble figuring out how to sum the records in the TimeLog table based on Department for a project.  My project table is also linked to many other tables to track cost for materials etc. I may have to write script to index through all the TimeLog records and test for the department, but that seems way too complicated.  I'm sure there is an easy way to do this, but I am missing it. 

I guess I'm looking for some sort of "sumif" function that will sum each record in the timelog if Department = "Labor" for example.  Of course because of the relationship with ProjNum, the sum function adds all hours for the project regardless of the Department.

Any help would be greatly appreciated.

Outcomes