Sum between two columns using Offset or SumProduct

Davesh Garg

Board Regular
Joined
Jun 3, 2014
Messages
64
Hi All,
Please assist me on below table so that formula can calculate counts of 'Yes' between 2 "Total" between different months. Please review below table for the reference.

Formula auto calculate Mar month 'Yes' for different persons for that month only. Similarly for Apr and May month. Any help is really appreciated. Thanks

1717613293773.png
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Which version of Excel are you using?

In E2, try:
Excel Formula:
=COUNTIF(B2:D2,"Yes")
 
Upvote 0
@Davesh Garg Might this help?
AutoTraining.xlsm
ABCDEFGHIJKLMNOP
1Person3/1/243/12/243/25/24Total-Mar4/2/244/8/244/15/254/22/244/29/24Total-Apr5/3/245/9/245/16/245/27/24Total-May
2PYesYes2YesYesYes30
3SYes1YesYes2Yes1
4QYesYesYes3Yes10
5RYes10Yes1
6T0YesYes2YesYes2
7U000
Input Template
Cell Formulas
RangeFormula
E2:E7,P2:P7,K2:K7E2=SUMPRODUCT(($B2:D2="Yes")*(IFERROR(MONTH($B$1:D$1),99)=MONTH(D$1)))
 
Upvote 0
Solution
On reflection, I think I may be overcomplicating it. 🤣
Here is a simpler formula that can be dragged down from E2 and then copy/pasted to K2:K? etc.

AutoTraining.xlsm
ABCDEFGHIJKLMNOP
1Person3/1/243/12/243/25/24Total-Mar4/2/244/8/244/15/254/22/244/29/24Total-Apr5/3/245/9/245/16/245/27/24Total-May
2PYesYes2YesYesYes30
3SYes1YesYes2Yes1
4QYesYesYes3Yes10
5RYes10Yes1
6T0YesYes2YesYes2
7U000
Input Template
Cell Formulas
RangeFormula
E2:E7,P2:P7,K2:K7E2=COUNTIF($B2:D2,"Yes")-SUM($B2:D2)
 
Upvote 0
Thanks Snakehips. This assist and I have added year also in this Sumproduct formula :)
Excel Formula:
=SUMPRODUCT(($C2:D2="Yes")*(IFERROR(MONTH($C$1:D$1),99)=MONTH(D$1))*(IFERROR(YEAR($C1:D$1),99)=YEAR(D$1)))
 
Upvote 0
On reflection, I think I may be overcomplicating it. 🤣
Here is a simpler formula that can be dragged down from E2 and then copy/pasted to K2:K? etc.

AutoTraining.xlsm
ABCDEFGHIJKLMNOP
1Person3/1/243/12/243/25/24Total-Mar4/2/244/8/244/15/254/22/244/29/24Total-Apr5/3/245/9/245/16/245/27/24Total-May
2PYesYes2YesYesYes30
3SYes1YesYes2Yes1
4QYesYesYes3Yes10
5RYes10Yes1
6T0YesYes2YesYes2
7U000
Input Template
Cell Formulas
RangeFormula
E2:E7,P2:P7,K2:K7E2=COUNTIF($B2:D2,"Yes")-SUM($B2:D2)
Hi Snakehips,
This formula simply helps as compared to SumProduct formula as this one is very simple :)
Just wanted to confirm if we can apply Offset formula also which auto considers Sum or Count till previous column/row, then it is something which can be used in variable terms even if user added column prior to any Total column, as it is a recurring worksheet where formula has to change it manually otherwise.
Thanks
 
Upvote 0
Hi Snakehips,
This formula simply helps as compared to SumProduct formula as this one is very simple :)
Just wanted to confirm if we can apply Offset formula also which auto considers Sum or Count till previous column/row, then it is something which can be used in variable terms even if user added column prior to any Total column, as it is a recurring worksheet where formula has to change it manually otherwise.
Thanks
In simple terms, is there a way that D2 can be calculated by some formula considering current cell as Total -1. This way it calculates automatically D2 cell. Please assist on this.
Thanks
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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