Count number of rows based on date

BrutalLogiC

Active Member
Joined
Feb 26, 2006
Messages
267
Office Version
  1. 2016
Platform
  1. Windows
Hi I was given a spreadsheet with the formula below which is counting the number of entries in a given month:
{=SUM(IF(MONTH(Sheet1!$V$1195:$V$1481)=MONTH(E4),IF(YEAR(Sheet1!$V$1195:$V$1481)=YEAR(E4),1,0),0))}

column V has dates entered like dd/mm/yyyy
E4 = 01/01/2021
E5 = 01/02/2021
etc

is there a better way of doing this formula so it's not an array....
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Perhaps
Excel Formula:
=COUNTIFS(Sheet1!$V$1195:$V$1481,">"&EOMONTH(E4,-1),Sheet1!$V$1195:$V$1481,"<="&EOMONTH(E4,0))
The first EOMONTH function is not strictly necessary but it will allow the formula to work correctly if the dates in E4, etc are anything other than the 1st (the same as your original formula would).
 
Upvote 0
Solution
Perhaps
Excel Formula:
=COUNTIFS(Sheet1!$V$1195:$V$1481,">"&EOMONTH(E4,-1),Sheet1!$V$1195:$V$1481,"<="&EOMONTH(E4,0))
The first EOMONTH function is not strictly necessary but it will allow the formula to work correctly if the dates in E4, etc are anything other than the 1st (the same as your original formula would).
Thanks very much.
 
Upvote 0

Forum statistics

Threads
1,215,013
Messages
6,122,694
Members
449,092
Latest member
snoom82

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