Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Sum Values in One Range Based on Criteria in Another

I have a spreadsheet with a list of weights and another list based on a drop-down selection with the choices "Yes" and "No" and I need to make a weighted sum from it.

Right now I have a very nasty looking function:

=D5*IF(E5="Yes",1,0)+D6*IF(E6="Yes",1,0)+D7*IF(E7="Yes",1,0)+D8*IF(E8="Yes",1,0)+D9*IF(E9="Yes",1,0)+D10*IF(E10="Yes",1,0)

I'd like to find a way to simplify this. A sample set of data looks like this:

+---+-----+
| 1 | Yes |
+---+-----+
| 4 | No  |
+---+-----+
| 1 | Yes |
+---+-----+
| 2 | Yes |
+---+-----+
| 2 | No  |
+---+-----+

This would produce a result of 1+1+2=4

Is there any way to get results like this in a simpler way than the way I'm currently using?

share|improve this question
add comment

marked as duplicate by Sathya Jun 3 '12 at 9:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 3 down vote accepted

=SUMIF(B:B,"yes",A:A) Use the sumif formula

share|improve this answer
add comment

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