Counting Months where range is Dynamic

Kemidan2014

Board Regular
Joined
Apr 4, 2022
Messages
226
Office Version
  1. 365
Platform
  1. Windows
I have a spreadsheet that Access will be exporting data into for graphing.

I need to be able to set up the formula so the range is dynamic, When i use "=SUMPRODUCT(--((MONTH(NONCTab_Query!B2:B7)=Calculations!E2)))" it calculates correctly. where calculations E2 is just a cell with a number corresponding to the month. however the RANGE "NONCTab Query!B2:B7" will be dynamic and grow overtime. and simply expanding the range adds to the result as apparently Null cells are considered "True"?

My dates are formatted as mm/dd/yyyy

how can i change the function so it will add up correctly and allow me to pad the range large enough to cover expected range growth and ignore Null

Keep in mind i will also have to include ADDITIONAL criteria for further counting for other Graphs have yet to create.

all of the internet examples and helpful videos only handle situations of fixed ranges.

I also tried CountIFS but just yielded 0 as a result.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Have you tried using Loop in VBA to do you calculations. You can use a row count to determine what your range will be and then a loop for your calculation. Then add your results back to your spreadsheet. This way it will automatically calculate your new range every time you run it and you never have to go in to extend the range.
 
Upvote 0
How about
Excel Formula:
=SUMPRODUCT((MONTH(NONCTab_Query!B2:B100)=E2)*(NONCTab_Query!B2:B100<>""))
 
Upvote 0
Solution
FLuff your formula worked. I was also able to add more criteria for another column of data which is still adding correctly. THank you
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0
An option to count the entire column and not slow the formula down:
Excel Formula:
=LET(f,MONTH(FILTER(NONCTab_Query!B:B,(NONCTab_Query!B:B<>""))),COUNT(FILTER(f,f=E2)))
 
Upvote 0

Forum statistics

Threads
1,215,674
Messages
6,126,149
Members
449,294
Latest member
Jitesh_Sharma

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