COUNTIFS / WEEKNUM

surkdidat

Well-known Member
Joined
Oct 1, 2011
Messages
582
Office Version
  1. 365
HI

I have the following formula
Excel Formula:
=COUNTIFS('[Tracker.xlsm]Master List'!$J:$J,"COMPLETE",'[Tracker.xlsm]Master List'!$L:$L,">="&TODAY())

which works fine to give me the count of occurrences that happened today.

How do I amend it to do this week please (starting on a Monday)?

I have tried
Excel Formula:
=COUNTIFS('[Tracker.xlsm]Master List'!$J:$J,"COMPLETE",'[Tracker.xlsm]Master List'!$L:$L,">="&WEEKNUM(TODAY()))

but this counts over 1500 occurrences, when it only should be 6!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Does your data span multiple years of dates?
If so, you will need to check the year in addition to the week number.
 
Upvote 0
AH, this
Does your data span multiple years of dates?
If so, you will need to check the year in addition to the week number.
may be the case! So, how would I need to amend that please for the current year/.
 
Upvote 0
Can you post a small example of your data, along with your expected results (and explanation of exactly what you are trying to count, so we make sure we write the criteria according to what you need)?
 
Upvote 0
(In this scenario I am taking today to be Tuesday 28 September, so to differentiate between todays count and weeks count. The week should start on a Monday

This coding works fine for todays count : -
Excel Formula:
=COUNTIFS('[Tracker.xlsm]Master List'!$J:$J,"COMPLETE",'[Tracker.xlsm]Master List'!$L:$L,">="&TODAY())

Column JColumn KColumn LCOUNT FOR TODAY?COUNT FOR WEEK?
CURRENT STATUSNOTESUPDATED--
COMPLETEDbsguihiu 27/9/21NOYES
COMPLETEDbdhygdyu26/9/21NONO
COMPLETEDhuhig28/9/21YESYES
ACTIVEhihguigui28/9/21NONO
ACTIVEhujughiug27/9/21NONO
COMPLETEDhugiugigi28/9/21YESYES
23
(TAKING TODAY IN EXAMPLE AS TUESDAY 28 SEPT)
 
Upvote 0
OK, in order to use WEEKNUM in our COUNTIFS, we are going to need to use a "helper" column.
So, if we use column O to return the weeknumber, here is the formula we could use for cell O3 to return the weeknumber:
Excel Formula:
=WEEKNUM(L3,2)
and copy down for all rows.

Likewise, we should add another helper column (column P) to return the year. That formula would look like this:
Excel Formula:
=YEAR(L3)
and copy down for all rows.

Then we could get our weekly count like this (to return for the current week/year):
Excel Formula:
=COUNTIFS([Tracker.xlsm]Master List'!J:J,"COMPLETE",[Tracker.xlsm]Master List'!O:O,WEEKNUM(TODAY(),2),[Tracker.xlsm]Master List'!P:P,YEAR(TODAY()))
 
Upvote 0
OK, in order to use WEEKNUM in our COUNTIFS, we are going to need to use a "helper" column.
So, if we use column O to return the weeknumber, here is the formula we could use for cell O3 to return the weeknumber:
Excel Formula:
=WEEKNUM(L3,2)
and copy down for all rows.

Likewise, we should add another helper column (column P) to return the year. That formula would look like this:
Excel Formula:
=YEAR(L3)
and copy down for all rows.

Then we could get our weekly count like this (to return for the current week/year):
Excel Formula:
=COUNTIFS([Tracker.xlsm]Master List'!J:J,"COMPLETE",[Tracker.xlsm]Master List'!O:O,WEEKNUM(TODAY(),2),[Tracker.xlsm]Master List'!P:P,YEAR(TODAY()))
Thank you for this. Unfortunately, the "Master Tracker Sheet" is locked/password protected, and I cannot edit/add anything to it,,, I am now wondering if the only work around is to have the week start and finish dates in a different tab, and then usingsome sort of formula around todays date being between two dates or something... Thank you anyway!
 
Upvote 0
Unfortunately, the WEEKNUM function is a scalar function, so cannot used directly in SUMPRODUCT or COUNTIFS formulas.

If you are able to put the current week starting and dates somewhere on the same sheet where you are returning this count, I think you can do what you want.
So, if in cell C1 we had the week starting date, and in cell D1, we had the week ending date, you could use this formula to return your weekly count:
Excel Formula:
=COUNTIFS([Tracker.xlsm]Master List'!J:J,"COMPLETE",[Tracker.xlsm]Master List'!L:L,">=" & C1,[Tracker.xlsm]Master List'!L:L,"<=" & D1)

And you can dynamically calculate the start of the current work week (the value for cell C1) like this:
Excel Formula:
=TODAY()-WEEKDAY(TODAY(),2)+1

and then D1 would just be:
Excel Formula:
=C1+6
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,042
Messages
6,122,810
Members
449,095
Latest member
m_smith_solihull

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