Count IFs not counting data correctly

dawidmns

New Member
Joined
Aug 5, 2022
Messages
8
Office Version
  1. 2013
Platform
  1. Windows
  2. MacOS
Hi

I have been trying to solve this for 2 days now without the luck.

I need to count "With QC - Trade" within last 30 days, then there will be other within 60 days, 90 days etc, but I need to sort out 30 days first.

I got this formula, data and calculation are on different tabs:

=COUNTIFS('Corporate Master'!F:F,"With QC - TRADE",'Corporate Master'!I:I,"<="&(NOW()-30))

So when I selected the data manualy, I got 11, and the formula counted 9, wham am I doing wrong?


1.png
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try change to:

=COUNTIFS('Corporate Master'!F:F,"With QC - TRADE",'Corporate Master'!I:I,"<="&(TODAY()-30))
 
Upvote 0
Using <= will give you results older than 30 days, if you want within the last 30 days then you need to use>=

Also, you should note the suggestion from @Phuoc above. Using NOW() in the formula means that it is time of day specific. If there is no time in the cell then dates are evaluated as midnight whilst NOW() looks at time of day as well, meaning that records on the first day of the 30 day window would be excluded.
 
Upvote 0
Thanks guys, unfortunetely I am still getting 9 instead of 11. I also tried changing <= to >= but none of the results match. I also tried with different cirteria under CDD status and the calculations (not seen on the picture) are not adding up to comparing to data selected manually.

If there anything else I can add here to give you better picture to find out the solution?
 
Upvote 0
I agree with @jasonb75 that within the last 30 days means you should be using ">=" in your countifs.
Also since you are using just dates that Today would be better than Now since Now is date and time.
The below works for me.

If you find it doesn't work, as an expirement add a "*" to the end of TRADE. If that fixes it then you have spaces at the end of 2 of the descriptions.
eg
Excel Formula:
=COUNTIFS('Corporate Master'!F:F,"With QC - TRADE*",'Corporate Master'!I:I,">="&(TODAY()-30))

20220805 Count If Dates dawidmns.xlsx
FGHIJKL
1
2CDD StatusCDD PermissionsCurrent CRRCDD Expiry DateFormula
3With QC - Trade4/08/202211=COUNTIFS('Corporate Master'!F:F,"With QC - TRADE",'Corporate Master'!I:I,">="&(TODAY()-30))
4With QC - Trade4/08/2022
5With QC - Trade4/08/2022
6With QC - Trade29/07/2022
7With QC - Trade31/07/2022
8With QC - Trade10/07/2022
9With QC - Trade10/07/2022
10With QC - Trade10/07/2022
11With QC - Trade22/07/2022
12With QC - Trade22/07/2022
13With QC - Trade3/08/2022
14With QC - Trade2/07/2022
15With QC - Trade3/07/2022
16With QC - Trade30/06/2022
17With QC - Trade9/06/2022
18With QC - Trade25/06/2022
Corporate Master
Cell Formulas
RangeFormula
K3K3=COUNTIFS('Corporate Master'!F:F,"With QC - TRADE",'Corporate Master'!I:I,">="&(TODAY()-30))
L3L3=FORMULATEXT(K3)
 
Upvote 0
One other thing to consider, are the dates correct for your regional settings?

I notice that the dates in the screen capture are UK format, if this is imported data and your system is set for US dates then that is likely to cause errors.
 
Upvote 0
I believe there is something wrong with the data collected. But I have no idea what is wrong, I have checked it, checked the date etc everything seems fine. Is there anyway I can upload the Excel document here so maybe someone can have a look what might be an issue of wrong calculations?
 
Upvote 0
I believe there is something wrong with the data collected. But I have no idea what is wrong, I have checked it, checked the date etc everything seems fine. Is there anyway I can upload the Excel document here so maybe someone can have a look what might be an issue of wrong calculations?
You can upload the file to any file sharing site, then provide a link for users here, so they can download it.
 
Upvote 0
Great, please let me know if you can access the file:

 
Upvote 0
That link comes back as "The selected transfer does not exist or has expired."
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

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