Update to sum from year and month

itsgrady

Board Regular
Joined
Sep 11, 2022
Messages
115
Office Version
  1. 2021
Platform
  1. Windows
  2. MacOS
I have two formulas that are summing according to month and not the month and the year. Since the new year started, they are no longer providing the correct information. They are adding all cells with January and I need only the 2024 year to sum. I have added a cell (AD3) for the year.

1st Formula:

=IF(SUMPRODUCT((--(MONTH(Table2[Date])=M7)),Table2[T1 Day])=0,"",SUMPRODUCT((--(MONTH(Table2[Date])=M7)),Table2[T1 Day]))

M7 has the number “1” for January, M8 has the number “2” for February, etc.

Table2[T1 Day] is what the column that is summing.

I have added a cell “AD3” for the year in AD3

2nd Formula:

This formula also need updating to sum by the year and the month.

=IFERROR(SUMPRODUCT((--(MONTH(Table2[Date])=$M7)),Table2[Acid])/O7,"")

Thanks for your help.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
How about

Excel Formula:
=LET(
s,SUMPRODUCT((MONTH(Table2[Date])=M7)*(YEAR(Table2[Date])=$AD$3)*Table2[T1 Day]),
IF(s=0,"",s)
)

and for the second one:

Excel Formula:
=IFERROR(SUMPRODUCT((MONTH(Table2[Date])=V7)*(YEAR(Table2[Date])=$AD$3)*Table2[Acid])/O7,"")
 
Upvote 1
Solution
How about

Excel Formula:
=LET(
s,SUMPRODUCT((MONTH(Table2[Date])=M7)*(YEAR(Table2[Date])=$AD$3)*Table2[T1 Day]),
IF(s=0,"",s)
)

and for the second one:

Excel Formula:
=IFERROR(SUMPRODUCT((MONTH(Table2[Date])=V7)*(YEAR(Table2[Date])=$AD$3)*Table2[Acid])/O7,"")

Thanks for taking time to help. I appreciate the updated codes. They worked perfectly and now I am ready for 2024, 2025, and beyond.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,953
Members
449,095
Latest member
nmaske

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