Using COUNTIF to counter number of times X appears in list

I am looking to create a spreadsheet that will be able to count the number of times a particular date appears in a list of dates & times. Below is a snapshot of the spreadsheet I am working with. This is access data for a security panel on a door. I am trying to count how many people access the door per day. I have been trying to use COUNTIF, but can't quite get the syntax right. Any help??

MacBook Pro Apple Silicon 2023

Posted on Feb 22, 2023 9:44 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 22, 2023 10:56 AM

Depends on the format of the column of "dates". Are they text or actual date&time values?


If the values in B are text and E1 has the text (not date & time value) Feb 22, 2023

=COUNTIF(B,E$1&"*")


If the values in B are date&time values and E1 has the date & time value 2/22/23 formatted any way you like to see it presented and was entered into the cell without any time (so it's value will be 2/22/23 12:00AM)

=COUNTIFS(B,">="&E$1,B,"<"&(E$1+1))

4 replies
Question marked as Top-ranking reply

Feb 22, 2023 10:56 AM in response to jennamc617

Depends on the format of the column of "dates". Are they text or actual date&time values?


If the values in B are text and E1 has the text (not date & time value) Feb 22, 2023

=COUNTIF(B,E$1&"*")


If the values in B are date&time values and E1 has the date & time value 2/22/23 formatted any way you like to see it presented and was entered into the cell without any time (so it's value will be 2/22/23 12:00AM)

=COUNTIFS(B,">="&E$1,B,"<"&(E$1+1))

Feb 23, 2023 5:55 AM in response to jennamc617

You might try something like this:


Add a column to your data table with a formula like this:




In the new column where column A contains the ISO message time:


=TEXTBEFORE(A2,"T")+"0m"


(the +"0m" coerces the text to a Date & Time value)


Then you can use COUNTIF like this:




=COUNTIF(Data::E,A2)


Change E to whatever column you have for the added column.


Or don't bother with a COUNTIF formula at all! Just use a Pivot Table, and get your answer with a few clicks and drags.


Click the data table and from the menu choose Organize > Create Pivot Table > On Current Sheet.


Then in the Pivot Options pane drag the Fields down into the boxes below as follows:





SG

Feb 22, 2023 11:37 AM in response to Badunit

Edit:


If the values in B are text and E1 has Feb 22, 2023

=COUNTIF(B,E$1&"*")


If the values in B are date & time values and you did not create a custom format that added EST to the end, I'm not sure what the second formula will do. Numbers does not have a built-in format that includes the time zone. It might adjust them to GST before it does the comparison.


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using COUNTIF to counter number of times X appears in list

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.