You can do that using a dummy column and use the same as a range for the sumif formula.
You should use an 'If' formula in the dummy column to populate it with say "A" only if it matches the criteria of your requirement.
Like you can use in C1 = if ( or (B1=x,B1=y),"A")
and then use the Sumif formula as =SUMIF($C$1:$C$50,.........)
Hope this meets your requirement.