@ > Home > Contents > SUMIF with a list as criteria Excel 97+
          A     B         C      D                      
    1  LName   FName  born     years
    2  Kennedy John F.19170529 3 
    3  Bush    George 19460706 8 
    4  Carter  James  19241001 4 
    5  Reagan  Ronald 19110206 8 
    6  Bush    G.H.W. 19240612 4 
    7  Ford    Gerald 19130714 2 

=SUMIF(A1:A7,"Bush",D1:D7) returns 12 years of Bush presidency. 

Question

Can I add the search "Kennedy" to this single formula?

Answer: Yes. 

=SUM(SUMIF(A1:A7,{"Bush","Kennedy"},D1:D7)) returns 15 (array formula not necessary)

This also works with a range:

={SUM(SUMIF(A1:A7,A2:A3,D1:D7))} returns 15 (array formula)

But: Please do not as shown above! A2:A3 should always be outside of A1:D7. Why? Imagine using A2:A6: "Bush" would be calculated as 2*(4+8), not as (4+8), because it is listed twice - and would be SUMIF'd twice!

COUNTIF can be used in this manner as well (without ,D1:D7).