> combine vlookup and if function. Use sumif it is values you need to be added
Will take some time, use the help files.
Vlookup - Searches for a value in the leftmost column of a table, and then
returns a value in the same row from a column you specify in the table. In
combining if before the vlookup you could get the answer you want i.e.
=if(A3="cat",Vlookup(a1,Sheet!'sheet1'A1:c20,3,False),...