I am trying to use Google Sheets to count the hours that my staff works every month. So far I have this:

In the left, my staff write their name and the account of hours they have worked that day. What I would like to do is to count the total hours each one of them has worked in the right hours-column. Is this possible? So far I only know that you can count how many times they have worked using countif, but that does not count the account of hours they have worked.


You may want to give the query() function a try. Assuming your data is in the range A1:D, try:

=query(A1:B; "select A, sum(B) where A <>'' group by A"; 1)

Note: depending on your locale you may have to change the semi-colons with comma's..

This is a one formula solution that will update when new rows are added. I hope that helps ?

  • Thanks! It works, but is there any way I can get rid of the "sum" in front of hours?
    – klasurban
    May 5 '15 at 9:59
  • Yes, try: =query(A1:B; "select A, sum(B) where A <>'' group by A label sum(B) 'Hours' "; 1)
    – JPV
    May 5 '15 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.