How to calculate Total for different Group from user entries

U

unplugs

I got a Question.... Hope someone can help me to solve...

I had do 1 userform that get entries from users. I will get their nam
and project that they handle and the hours they spent for the project.

For example, I get 5 entries, which are:
Name Project Hours
Dan A 3
Upls B 5
In A 5
Kon B 2
Kasn C 3

Well, after I get this entries, I will sort them base on the projec
name. My question is how we gonna to calculate the total hours fo
project A, project B and Project C? Since I dunno how many entries wil
be made by users(either 2 projects, either 4 projects...and it is no
fix) I cannot have total1 = project A, total2= project B..... Is ther
any method to calculate the total for each projects
 
P

papou

Assuming project Names starting from B2 and Hours from C2 on sheet Sheet1:
lastr = Worksheets("Sheet1").Range("B65536").End(xlUp).Row
ProjectA = Evaluate("=SUMIF(B2:B" & lastr & ",""A"",C2:C" & lastr & ")")
ProjectB = Evaluate("=SUMIF(B2:B" & lastr & ",""B"",C2:C" & lastr & ")")
MsgBox "Project A: " & ProjectA & vbCrLf & "Project B: " & ProjectB

HTH
Regards
Pascal
 
Top