COUNTIF assistance

Mikec1012

New Member
Joined
Oct 24, 2017
Messages
30
Hello everyone! I currently use the following formula:

=COUNTIFS('CLEX01 '!$K:$K,'TEST REPORT'!H5,'CLEX01 '!$A:$A,'TEST REPORT'!H4)

Column 'CLEX01 '!$K:$K - it's the day something was completed
Cell 'TEST REPORT'!H5 - a cell where a user can change the date to generate a report
Column 'CLEX01 '!$A:$A - has a list of employee names
Cell 'TEST REPORT'!H4 - a cell where the employee name can be changed

I am using this in 3 sections. First section, it does everything fine.

2nd Section - I need to tweak the formula to now give a Month To Date report based off the MONTH in Cell H5. How would I adjust the formula?

3rd section - Similar to section 2 but I would simply search for a COUNTIF based off a months value for all employees. However, it would still need to reference Cell H5 to pull the month.

Any help would be awesome.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try this for 2nd section:

Code:
[TABLE="width: 64"]
<tbody>[TR]
  [TD="width: 64"]=SUMPRODUCT(('[COLOR=#333333]CLEX01 '!$A:$A[/COLOR]=[COLOR=#333333]'TEST REPORT'!H4[/COLOR])*(MONTH([COLOR=#333333]'CLEX01 '!$K:$K[/COLOR])=MONTH([COLOR=#333333]'TEST REPORT'!H5[/COLOR])))[/TD]
[/TR]
</tbody>[/TABLE]

And this for 3rd:

Code:
[TABLE="width: 64"]
<tbody>[TR]
  [TD="width: 64"]=SUMPRODUCT((MONTH([COLOR=#333333]'CLEX01 '!$K:$K[/COLOR])=MONTH([COLOR=#333333]'TEST REPORT'!H5[/COLOR]))*1)[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
I tried copying your formulas into my file and I get the #VALUE ! error in the cell. I did go back and double checked to ensure the reference was correct while using your base formula.
 
Upvote 0
Here is an option using COUNTIFS.
Change ranges to match your data.
Excel Workbook
ABCGH
1NamesDate
2Name19/12/2017
3Name210/2/2017
4Name110/5/2017NameName1
5Name49/8/2017Report Date9/1/2017
6Name19/16/2017
7Name69/17/2017
8Name710/2/2017Month Count3
9Name19/22/2017
10Name910/5/2017All Emp. Month5
11Name1010/28/2017
Sheet
 
Upvote 0
Ok so I am working with adjusting my formula for my cell. I have the H8 one working but when I change my Report Date to say 09/08/2017 - it will then edit the month count. I ideally just need it to search 2 columns based off Employee Name and Date as long as it falls within that month. I will go back and ensure I copied correctly.
 
Upvote 0
I don't get it. Sumroduct works in my simulation here.

But if AhoyNC's formula works, fine. But it works better like this for H8:

Code:
[TABLE="width: 64"]
<tbody>[TR]
  [TD="width: 64"]=COUNTIFS($A$2:$A$151,$H$4,$K$2:$K$151,">="&DATE(YEAR(H5),MONTH($H$5),1),$K$2:$K$151,"<="&EOMONTH($H$5,0))[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Thank you for pointing me in the right direction. Did my reply make sense?

Your first formula - I tweaked it to this:
=COUNTIFS('CLEX01 '!A:A,C4,'CLEX01 '!K:K,">="&C5,'CLEX01 '!K:K,"<="&EOMONTH(C5,0))

A:A - reference to employee name
C4 - employee name
K:K - date work was done
C5 - date that the user can enter

C5 can be anything from 10/01/2017 to 11/15/2017 - any date.

However, when I change the date to modify the daily report - it changes the values of the other two formulas.

I need the 2nd formula to search my data and tally for specific employees and then based off the month.

The 3rd box... I need to just search all of the data based off the month in regards to date. Employee is of no concern. I just need to count the column and anything that falls from the 1st of the month to the end of the month will be accounted for and does not change.

Hope this isn't confusing.
 
Upvote 0
See if this works for you.
You will need to change ranges and sheet names to match your data.

As pointed out by estevoba, since your dates in C5 can be any date and not just first of the month the formulas I gave you needed to be changed to find the first day of the month for monthly figures.
Excel Workbook
ABCDEJK
1NamesDate
2Name19/12/2017
3Name2Find10/2/2017
4Name1Name110/5/2017
5Name49/12/20179/8/2017
6Name19/12/2017
7Name62Day Count for Emp.9/17/2017
8Name73Month Count for Emp.10/2/2017
9Name15Month Count All Emp.9/2/2017
10Name910/5/2017
11Name1010/28/2017
Sheet
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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