Summing two arrays

n1lesh

Board Regular
Joined
Apr 3, 2015
Messages
61
TABLE 1

[TABLE="width: 647"]
<colgroup><col><col><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]NAME[/TD]
[TD]SUNDAY[/TD]
[TD]MONDAY[/TD]
[TD]TUESDAY[/TD]
[TD]WEDNESDAY[/TD]
[TD]THURSDAY[/TD]
[TD]FRIDAY[/TD]
[TD]SATURDAY[/TD]
[/TR]
[TR]
[TD]A ASBURY[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]N PATEL[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD]TOTAL[/TD]
[/TR]
</tbody>[/TABLE]
TABLE 2

[TABLE="width: 576"]
<colgroup><col width="72" span="8" style="width:54pt"> </colgroup><tbody>[TR]
[TD="width: 72"][/TD]
[TD="width: 72"]SUNDAY[/TD]
[TD="width: 72"]MONDAY[/TD]
[TD="width: 72"]TUESDAY[/TD]
[TD="width: 72"]WEDNESDAY[/TD]
[TD="width: 72"]THURSDAY[/TD]
[TD="width: 72"]FRIDAY[/TD]
[TD="width: 72"]SATURDAY[/TD]
[/TR]
[TR]
[TD]A ASBURY[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]N PATEL[/TD]
[TD][/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]J JONES[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]L BULL[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD]S MASON[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]J JHALLI[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]N KUMAR[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

I have two different tables on two different sheets
Table 1 shows the a number if a person has worked on a particular day
Table 2 shows the amount of hours a person works on a particular day

what i need and would be totally greatfull for is a formula in table 1 which can total
the amount of hours worked which corresponds across the two sheets

so the answer in this case would be 80 totalling A Asbury & N Patel even though i have put a 1
in for N Patel on Sunday & Saturday
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
[TABLE="width: 1076"]
<colgroup><col><col><col><col span="2"><col><col><col><col><col></colgroup><tbody>[TR]
[TD]TABLE 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAME
[/TD]
[TD]SUNDAY[/TD]
[TD]MONDAY[/TD]
[TD]TUESDAY[/TD]
[TD]WEDNESDAY[/TD]
[TD]THURSDAY[/TD]
[TD]FRIDAY[/TD]
[TD]SATURDAY[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A ASBURY[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]N PATEL[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]TOTAL[/TD]
[TD="align: right"]76[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TABLE 2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]SUNDAY[/TD]
[TD]MONDAY[/TD]
[TD]TUESDAY[/TD]
[TD]WEDNESDAY[/TD]
[TD]THURSDAY[/TD]
[TD]FRIDAY[/TD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][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 6"]Why bother with a 1 for N Patel on Sunday and Saturday? He did not work so zero for each of those days[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 6"]I played with hours worked on each day because if always 8 you count the 1's with a non zero in lower table[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 2"]76 calculated by[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 5"]=SUMPRODUCT(($B$4:$H$4=1)*(B11:H11))+SUMPRODUCT(($B$5:$H$5=1)*(B12:H12))[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Data

[TABLE="class: grid, width: 526"]
<tbody>[TR]
[TD][/TD]
[TD]SUNDAY[/TD]
[TD]MONDAY[/TD]
[TD]TUESDAY[/TD]
[TD]WEDNESDAY[/TD]
[TD]THURSDAY[/TD]
[TD]FRIDAY[/TD]
[TD]SATURDAY[/TD]
[/TR]
[TR]
[TD]A ASBURY[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]N PATEL[/TD]
[TD]
[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]J JONES[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]L BULL[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]S MASON[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]J JHALLI[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]N KUMAR[/TD]
[TD]8[/TD]
[TD]8[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

Summary

[TABLE="class: grid, width: 627"]
<colgroup><col span="4"><col><col span="2"><col><col></colgroup><tbody>[TR]
[TD]NAME[/TD]
[TD]SUNDAY[/TD]
[TD]MONDAY[/TD]
[TD]TUESDAY[/TD]
[TD]WEDNESDAY[/TD]
[TD]THURSDAY[/TD]
[TD]FRIDAY[/TD]
[TD]SATURDAY[/TD]
[TD]subtotal[/TD]
[/TR]
[TR]
[TD]A ASBURY[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD] [/TD]
[TD] [/TD]
[TD="align: right"]40[/TD]
[/TR]
[TR]
[TD]N PATEL[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]40[/TD]
[/TR]
</tbody>[/TABLE]

In I2 enter and copy down:
Rich (BB code):
=SUMPRODUCT($B2:$H2,INDEX(Data!$B$2:$H$8,MATCH($A2,Data!$A$2:$A$8,0),0))
 
Upvote 0
[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]
a
[/TD]
[TD]
b
[/TD]
[TD]
c
[/TD]
[TD]
d
[/TD]
[TD]
e
[/TD]
[TD]
f
[/TD]
[TD]
g
[/TD]
[TD]
h
[/TD]
[TD]
i
[/TD]
[TD]
j
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]name[/TD]
[TD]sunday[/TD]
[TD]monday[/TD]
[TD]tuesday[/TD]
[TD]wednesday[/TD]
[TD]thursday[/TD]
[TD]friday[/TD]
[TD]saturday[/TD]
[TD]table1[/TD]
[TD]sheet1[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]a asbury[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]n patel[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD]
1​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]total[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
80​
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]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
[TD]J JHALLI[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
8​
[/TD]
[TD]
8​
[/TD]
[TD]
8​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
8
[/TD]
[TD]N KUMAR[/TD]
[TD]
8​
[/TD]
[TD]
8​
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

SHEET1

H5=
SUMPRODUCT(ISNUMBER(MATCH(Sheet2!A2:A8,Sheet1!A2:A3,0))*(Sheet2!B2:H8))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,821
Messages
6,181,163
Members
453,021
Latest member
Justyna P

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