Add certain rows based on column header

jfrad

New Member
Joined
Feb 28, 2018
Messages
4
So I may be over thinking this, but I need a formula that will take any column with the header MONDAY and sum rows 4-6.


[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD="align: center"]MONDAY[/TD]
[TD="align: center"]MONDAY[/TD]
[TD="align: center"]TUESDAY[/TD]
[TD="align: center"]TUESDAY[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD] [/TD]
[TD="align: center"]AM[/TD]
[TD="align: center"]PM[/TD]
[TD="align: center"]AM[/TD]
[TD="align: center"]PM[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD="align: center"]A[/TD]
[TD]50[/TD]
[TD]250[/TD]
[TD]200[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD="align: center"]B[/TD]
[TD]100[/TD]
[TD]100[/TD]
[TD]250[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD="align: center"]C[/TD]
[TD]50[/TD]
[TD]100[/TD]
[TD]50[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD="align: center"]D[/TD]
[TD]200[/TD]
[TD]200[/TD]
[TD]50[/TD]
[TD]250[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD="align: center"]E[/TD]
[TD]200[/TD]
[TD]50[/TD]
[TD]100[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD="align: center"]F[/TD]
[TD]250[/TD]
[TD]250[/TD]
[TD]200[/TD]
[TD]50[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Excel 2013/2016
ABCDEF
1TUESDAYMONDAYMONDAYTUESDAY
2AMPMAMPM600
350250200100
410010025050
55010050200
620020050250
72005010050
825025020050
Sheet2
Cell Formulas
RangeFormula
F2{=SUMPRODUCT(MMULT(--(A1:D1="MONDAY"),TRANSPOSE(A3:D8)),{0,1,0,1,0,0})}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
So I tried this in my workbook and I'm getting a #VALUE ! error.

Here is what the formula looks like with my workbook data =SUMPRODUCT(MMULT(--(Sheet1!A1:$P$1=Sheet2!O7),TRANSPOSE(Sheet1!$A$71:$P$78)),{0,1,0,1,0,0})

I've never used the MMULT and TRANSPOSE functions before so I'm not sure if I did it correctly.
 
Upvote 0
You need to adjust the last part of the formula to match the rows that you want to sum. So you are looking at rows 71 to 78, if you do:

=SUMPRODUCT(MMULT(--(Sheet1!A1:$P$1=Sheet2!O7),TRANSPOSE(Sheet1!$A$71:$P$78)),{0,1,0,1,0,0,0,0})

you will sum only rows 72 and 74
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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