COUNTIF w/dates not calculating correctly

tuckercp05

New Member
Joined
Nov 30, 2022
Messages
2
Office Version
  1. 365
Platform
  1. MacOS
I created a separate worksheet to test this theory, because I cannot understand for the life of me what is going on with my Excel, or maybe I'm missing something and someone could point me in the right direction. I added 8 random dates, and to test the COUNTIF function, created a simple formula for counting the values if a greater than date. Somehow it's returning 6 when it is greater than all 8 values in the array. When changing the date entirely, a value of 8 is returned although I can clearly count the number should be 3.

Are my dates or operations incorrect?
 

Attachments

  • Screenshot 2022-11-30 at 7.42.36 PM Medium.jpeg
    Screenshot 2022-11-30 at 7.42.36 PM Medium.jpeg
    75.4 KB · Views: 17
  • Screenshot 2022-11-30 at 7.43.29 PM Medium.jpeg
    Screenshot 2022-11-30 at 7.43.29 PM Medium.jpeg
    76.3 KB · Views: 16

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Welcome to the MrExcel board!

Your dates are not true dates (numbers), they are text values. Therefore your countif is looking at the values alphabetically, not numerically, and is returning the correct results based on that.
Try formatting column A with a date format and then re-enter the date values.
 
Upvote 0
Hi Peter, I have attempted a few solutions and nothing seems to work.

- Formatting changes nothing within the cells
=DATEVALUE(A1) returns #VALUE error
=DATE(YEAR(A1),MONTH(A1),DAY(A1)) returns #VALUE error
=INT(A1) returns #VALUE error
=DATEVALUE(TEXT(A2,"yyyy-mm-dd")) returns #VALUE error

I received a csv file previously whereby I attempted these following solutions to no avail.

Therefore, I simply made a new sheet and inputted the values as such "10/4/2001" to see if Excel had anyway of converting this to a date value, but none of these are working. Is text to columns my only option at this point?
 
Upvote 0
Select the range which you want to convert and go to text to columns then follow the screenshots exactly, at the end click finish.
 

Attachments

  • 1.png
    1.png
    102.9 KB · Views: 34
  • 2.png
    2.png
    108.1 KB · Views: 35
  • 3.png
    3.png
    102.9 KB · Views: 34
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,148
Members
448,552
Latest member
WORKINGWITHNOLEADER

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