Search code examples
excelexcel-formulaworksheet-functionsumifs

Compare row by row among two column ranges


I have two columns of data, one with dollar amounts and another with a text value. I'm trying to create a formula at the bottom that will add together only the values in A for which the corresponding row in column B equals "Yes". So in the example below my formula would return a sum of 1000:

|    A     |    B     |
|500       |Yes       |
|150       |No        |
|500       |Yes       |
|533       |No        |

|1000      |

My actual spreadsheet has many more rows, so I want a formula that can compare the entire range in column A against the entire range in column B, row by row. Is this possible to do without having to set up a macro?


Solution

  • Please try:

    =SUMIF(B1:B4,"Yes",A1:A4)  
    

    Adjust the ranges to suit but ensure they are of equal size.