Search code examples
excelexcel-formulasumvlookup

In a 2 column grid, match multiple values from the first column, and add the associated values for each from the second column


Consider this set:

A B
YES 1
NO 3
NO 3
NO 2
NO 5
YES 2
YES 1

I would like to create a formula that will choose all the values for "YES" from column 1, and for each match, add the values from column 2 (4).

I've attempted this using =SUM(VLOOKUP("YES",A1:B7, 2, FALSE) But this only returns the number of the first value found.

Any ideas how I can do this?


Solution

  • Use SUMIFS:

    =SUMIFS(B:B,A:A,"YES")
    

    enter image description here