Q:

How to SUM values in cells if other cell in each row contains a particular value?

So imagine a timesheet where we are trying to add the number of hours spent on a particular task. I'm wondering how to add the value, in this case number of hours, if the value of task equals, say, Project Management. So, in each row we have something like:
Project  |  # of Hours  |  Task
Foo             3          PM
Foo             2          CD
Bar             1.5        PM

I've seen a lot of solutions on how to count how many cells or rows contain the value, but here I want to get a SUM of values in the # of Hours column where the Task = PM. So the total should be 4.5. The values in Task are selected from a list, so there shouldn't be any worry about typos.
Thanks!

A:

The SUMIF function exists for exactly this purpose. Your formula would be something like =SUMIF($C$1:$C$X,"PM",$B$1:$B$X), where X is the last row of your data. You can also use a cell reference in place of "PM", so you can create a list of all possible tasks and put the formula in the next column.

