vlookup to return the sum of multiple columns for multiple result rows

stevensondas

New Member
Joined
Nov 26, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi,

I am trying to develop a formula that allows me to sum the hours by resource in a spreadsheet. I have resources (people) in rows, and they appear in multiple tasks (rows) in the spreadsheet. They have hours spread across columns for the month they are forecasted to perform work in. I want to sum all the hours for a resource for each year (2021, and 2022). Any recommendations on a formula to do this is greatly appreciated. Thanks for taking a look!

hours_example.xlsx
ABCDEFGHIJ
1
220212022
3TaskResourceOctNovDecJanFebMarApril
41Mike12012012080808080
52John80808080808080
63Tom160160160160160160160
74Chris40404040404040
85Mike40404040404040
96Wendy120120120160160160160
107John10101010101010
11
12
1320212022
14Mike
15John
16Tom
17Chris
18Wendy
Sheet1

hours_example.JPG
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Welcome to the MrExcel board!

Your task would be much easier if the year was repeated in each cell across row 2. Is that a possibility for you?

21 11 27.xlsm
ABCDEFGHIJ
1
22021202120212022202220222022
3TaskResourceOctNovDecJanFebMarApril
41Mike12012012080808080
52John80808080808080
63Tom160160160160160160160
74Chris40404040404040
85Mike40404040404040
96Wendy120120120160160160160
107John10101010101010
11
12
1320212022
14Mike480480
15John270360
16Tom480640
17Chris120160
18Wendy360640
Sum
Cell Formulas
RangeFormula
C14:D18C14=SUMPRODUCT(($D$2:$J$2=C$13)*($C$4:$C$10=$B14)*$D$4:$J$10)
 
Upvote 0
Solution
If you really want to do it without those extra values in row 2, then ...

21 11 27.xlsm
ABCDEFGHIJ
1
220212022
3TaskResourceOctNovDecJanFebMarApril
41Mike12012012080808080
52John80808080808080
63Tom160160160160160160160
74Chris40404040404040
85Mike40404040404040
96Wendy120120120160160160160
107John10101010101010
11
12
1320212022
14Mike480480
15John270360
16Tom480640
17Chris120160
18Wendy360640
Sum (2)
Cell Formulas
RangeFormula
C14:D18C14=LET(R,$C$4:$C$10,Y,$D$2:$J$2,S,MATCH(C$13,Y,0),SUM(INDEX(FILTER($D$4:$J$10,R=$B14),SEQUENCE(COUNTIF(R,$B14)),SEQUENCE(,IFERROR(MATCH(C$13+1,Y,0),COLUMNS(Y)+1)-S,S))))
 
Upvote 0
Welcome to the MrExcel board!

Your task would be much easier if the year was repeated in each cell across row 2. Is that a possibility for you?

21 11 27.xlsm
ABCDEFGHIJ
1
22021202120212022202220222022
3TaskResourceOctNovDecJanFebMarApril
41Mike12012012080808080
52John80808080808080
63Tom160160160160160160160
74Chris40404040404040
85Mike40404040404040
96Wendy120120120160160160160
107John10101010101010
11
12
1320212022
14Mike480480
15John270360
16Tom480640
17Chris120160
18Wendy360640
Sum
Cell Formulas
RangeFormula
C14:D18C14=SUMPRODUCT(($D$2:$J$2=C$13)*($C$4:$C$10=$B14)*$D$4:$J$10)
It in fact IS a possibility for me. Thank you for the reply. Trying it now, will report back on results!
 
Upvote 0
Welcome to the MrExcel board!

Your task would be much easier if the year was repeated in each cell across row 2. Is that a possibility for you?

21 11 27.xlsm
ABCDEFGHIJ
1
22021202120212022202220222022
3TaskResourceOctNovDecJanFebMarApril
41Mike12012012080808080
52John80808080808080
63Tom160160160160160160160
74Chris40404040404040
85Mike40404040404040
96Wendy120120120160160160160
107John10101010101010
11
12
1320212022
14Mike480480
15John270360
16Tom480640
17Chris120160
18Wendy360640
Sum
Cell Formulas
RangeFormula
C14:D18C14=SUMPRODUCT(($D$2:$J$2=C$13)*($C$4:$C$10=$B14)*$D$4:$J$10)
It worked! Took me some trying, as I was dealing with multiple sheets and kept mis-matching the formula. But it works great! Thanks so much!
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,279
Members
449,075
Latest member
staticfluids

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