'EXCEL formula to automate wages

I think want a modified SUMIF, but cannot figure out how to do what I want. Here's the Setup:

enter image description here

This set of Formulas Does what I want, but does not scale well ie I need another IF statement for each added worker (Col A), and manually incriment each formula to the next cell D2, D3, D4...:

=IF(ISNUMBER(SEARCH(A1,D2)),B1,0)+IF(ISNUMBER(SEARCH(A2,D2)),B2,0)+IF(ISNUMBER(SEARCH(A3,D2)),B3,0)

=IF(ISNUMBER(SEARCH(A1,D3)),B1,0)+IF(ISNUMBER(SEARCH(A2,D3)),B2,0)+IF(ISNUMBER(SEARCH(A3,D3)),B3,0)

=IF(ISNUMBER(SEARCH(A1,D4)),B1,0)+IF(ISNUMBER(SEARCH(A2,D4)),B2,0)+IF(ISNUMBER(SEARCH(A3,D4)),B3,0)

You can see that here: enter image description here

So Bottom line, how can I Define Workers and wages in column A & B, add workers to tasks in Column D and get cost per hour in column E based on if the worker is found in column D.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source