Cannot figure out how to combine two if statements.

Worksheet 1 has detail data:

x=Name
y=Category
z=Total

In Worksheet 2 I want to summarize:

If(x=name)
and
If(y=category)
give me
z(total)

=IF(($b$5=range),IF($a4=range),range))