Needed: A formula to calculate the product of a multi-dimensional range of values...WITHIN A SINGLE CELL

pdx2dca

New Member
Joined
Oct 31, 2017
Messages
10
I’m pretty sure that manipulation of the SUMPRODUCT function will solve my problem…but I can’t figure out what that manipulation is. So here’s my question:


Is there a way to calculate – within a single cell – a multi-dimensional (i.e. multiple criteria) product of a range of values when the inputs for the criteria exist on a separate table?


For example, let’s say I want to calculate the total cost of both the regular and overtime hours worked by a group of employees. The employees’ hours over a three-day period are shown in the last three columns of the table below (Day1, Day2, and Day3):

EmployeeWage TypeDay1Day2Day3
Bill
Regular8 hours6 hours8 hours
BillOvertime2 hours1 hours
MaryRegular7 hours8 hours8 hours
MaryOvertime2 hours2 hours
KathrynRegular10 hours10 hours10 hours
JohnRegular6 hours8 hours4 hours
JohnOvertime1 hours

<tbody>
</tbody>


However, the regular and overtime wages for the employees are in a separate table, below:

EmployeeRegularOvertime
Kathryn$35.00 / hour$35.00 / hour
Mary$20.00 / hour$30.00 / hour
John$25.00 / hour$37.50 / hour
Bill$30.00 / hour$45.00 / hour

<tbody>
</tbody>

Is there a formula that will calculate – within a single cell – the total cost of all hours worked per employee wage and wage type? (Hint: The answer is $2,912.50)

FYI: I can re-sort and/or reorganize the employee wage table (the 2nd table above) if I need to. I can’t, however, do anything about the layout of the ‘Hours Worked’ table.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
I think this might help. Copy D11 down for each workman.

ABCDE
1EmployeeWage TypeDay1Day2Day3
2BillRegular8.006.008.00
3BillOvertime2.001.00
4MaryRegular7.008.008.00
5MaryOvertime2.002.00
6KathrynRegular10.0010.0010.00
7JohnRegular6.008.004.00
8JohnOvertime1.00
9
10EmployeeRegularOvertimeCost
11Kathryn35.0035.001050.00
12Mary20.0030.00580.00
13John25.0037.50487.50
14Bill30.0045.00795.00
152912.50

<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet36

Worksheet Formulas
CellFormula
D11=SUMPRODUCT(($A11=$A$2:$A$8)*($B11*(B$10=$B$2:$B$8))*$C$2:$E$8)+SUMPRODUCT(($A11=$A$2:$A$8)*($C11*(C$10=$B$2:$B$8))*$C$2:$E$8)
D15=SUM(D11:D14)

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Assuming first table in A1:E8 unchanged and second table in H1:J5 with only numbers, e.g. 35.00 formatted as currency to display $35.00 then you can use this formula

=SUMPRODUCT((0&SUBSTITUTE(C2:E8," hours",""))*(SUMIF(H2:H5,A2:A8,I2:I5)*(B2:B8="Regular")+SUMIF(H2:H5,A2:A8,J2:J5)*(B2:B8="Overtime")))

I get $2,915.50 as you suggest
 
Upvote 0
Unfortunately, that solution requires 5 cells (D11 through D14, with those summed in D15).

I need a formula within a single cell that will calculate the $2,915.50.
 
Upvote 0
That did it, Barry. Thanks.

In my actual 'hours worked' table, the " hours" suffix is a number format. So, I was able to do the calc with the following:

=SUMPRODUCT((C2:E8)*(SUMIF(H2:H5,A2:A8,I2:I5)*(B2:B8=I1)+SUMIF(H2:H5,A2:A8,J2:J5)*(B2:B8=J1)))

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,483
Messages
6,125,064
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top