Countif not counting???

deletedalien

Well-known Member
Joined
Dec 8, 2008
Messages
505
Office Version
  1. 2013
Platform
  1. Windows
ok i have a SIMPLE simple question......

I have the following file and it contains the following formula:

=COUNTIFS(E:E,A3,D:D,">="&$A$1,D:D,"<="&$B$1)

it basically counts the number of instances of user1 within a range of dates on cells A1 and B1

however it doesn't work for user1 (should be 23)
but yet has NO problem with user2 it IS 29 so..... WHAT GIVES!???

i uploaded the file to my onedrive here:

https://1drv.ms/x/s!Agyr_mEIeS75mAVOc_Cq_PTKoTcu

if ANYONE has any input i would greatly appreciate it.

Cheers.
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
The issue is your column D has both a date and a time in it (it's just formatted to show only the date), see below.
Your cell has a date of 6/12/17 with no time so Excel sees this as 6/12/17 12:00 AM, so your last two dates are not less than 6/12/17 12:00 AM,
Excel Workbook
BCDEF
16/12/20172-Jun-17User1
22-Jun-17User1
32-Jun-17User1
42-Jun-17User1
56/5/17 8:10 AMUser1
66/5/17 9:25 AMUser1
76/5/17 9:36 AMUser1
86/5/17 10:04 AMUser1
96/5/17 10:15 AMUser1
106/5/17 11:24 AMUser1
116/5/17 12:23 PMUser1
126/5/17 1:11 PMUser1
136/5/17 1:15 PMUser1
146/6/17 6:36 AMUser1
156/6/17 7:33 AMUser1
166/6/17 10:49 AMUser1
176/6/17 11:09 AMUser1
186/6/17 11:37 AMUser1
196/6/17 12:56 PMUser1
206/6/17 1:27 PMUser1
216/7/17 2:10 PMUser1
226/8/17 8:18 AMUser1
236/8/17 1:12 PMUser1
246/9/17 9:39 AMUser1
256/9/17 11:05 AMUser1
266/12/17 9:58 AMUser1FALSE
276/12/17 11:53 AMUser1FALSE
Sheet
 
Upvote 0
ok i have a SIMPLE simple question......

I have the following file and it contains the following formula:

=COUNTIFS(E:E,A3,D:D,">="&$A$1,D:D,"<="&$B$1)

it basically counts the number of instances of user1 within a range of dates on cells A1 and B1

however it doesn't work for user1 (should be 23)
The problem is your dates have time values associated with them... in particular, the two June 12th dates. Your formula is checking for dates before or equal to 6/12/2017. Because you did not put a time value with that date, its time value defaults 0:00; however, your two June 12th dates in the table have time values greater than 0:00 so they are outside of the range you are testing for. Change your search date to 6/13/2017 and change the last test to a simple less than instead of the less than or equal to and your formula will work the way you want.



but yet has NO problem with user2 it IS 29 so..... WHAT GIVES!???
No, your posted formula does not work correctly for User2 because you missed counting the three 6/10/2017 dates that are located after 6/12/2017 in the table. Actually, let me rephrase that... the formula counted the three 6/10/2017 dates after the three 6/12/2017 dates... it did not count the 6/12/2017 dates for the reason stated above... it is you who stopped counting at 6/12/2017 and did not count the three 6/10/2017 dates after them. The fact there were three balanced out the improper count that you did.



EDIT NOTE: I see AhoyNC posted my first point before I did (I guess I was writing my second point up and he "snuck" in before I finished writing everything up). In any case.... kudos to AhoyNC for getting there first.
 
Last edited:
Upvote 0
Solution
ohhh man!!!!

Initially i was like "what are these guys talking about, i clearly said equal or less than" and 2 seconds latter i was like ooooooohhhhhh.... DUHHH!!!!!

Because what I see is 6/12/2017, boom that's it done!

BUT..

i didn't think of how Excel sees it....

42,898.48 INSTEAD of 42,898.00 and of course those decimals (.48) makes the number GREATER than 42,898.00

so both you guys are absolutely right!

THANK you so much i was so close to banging my head on my desk over this! hahahaha
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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