How to calculate Total for different Group from user entries

  • Thread starter Thread starter unplugs
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top