Hello Mikey,
I assume you want to sum data column B when column D has a code belonging to one particular type. You could try a formula like this for "Office", repeat for your other types
=SUMPRODUCT((Sheet2!B2:B46="Office")*SUMIF(data!D:D,Sheet2!A2:A46,data!B:B))
Note: you have at least one trailing space in Sheet2 B2, you need to fix those otherwise the formula won't give the correct results....or add in a TRIM function, i.e.
=SUMPRODUCT((TRIM(Sheet2!B2:B46)="Office")*SUMIF(data!D:D,Sheet2!A2:A46,data!B:B))
regards, barry