Forum Discussion
Sum specific hours in an entire spreadsheet
To count the number of times a specific hour appears in a range of cells, you can use the following formula:
=COUNTIF(range, ">="&TIME(hour,0,0)&"<"&TIME(hour+1,0,0))
Here's how you can apply it to your scenario:
- Assuming your time entries are in a range of cells, for example, A2:A1000, adjust the range in the formula to match your actual data range.
- In the cell where you want to display the count for a specific hour, enter the formula:
=COUNTIF(A2:A1000, ">="&TIME(hour,0,0)&"<"&TIME(hour+1,0,0))
Replace hour with the desired hour (e.g., 6 for 6:00 to 6:59).
- Copy the formula to the cells for other hours.
The formula compares each time entry in the range to the specified hour range and counts the instances that fall within that hour.
Make sure that the time values in the range are recognized as actual times (not text) by Excel. You can format the cells as time to ensure proper recognition.
Note: If you have multiple columns for different people and you want to count the occurrences across all columns, you can adjust the range to include all relevant columns (e.g., A2:C1000).
Hope I got it right. otherwise please add more detailed information. Step by step (cell by cell) description, a photo or a file (without sensitive data) would help. Excel version, operating system, storage medium, etc. would also help.
- TreetrunksMMJun 07, 2023Copper Contributor
Thank you for your quick reply. I do have that formula plugged in and followed your instructions, but it's still either showing either "0:00" or just "0". The cells are recognized as times and the version is the 2007 version.
These two photos show what the spreadsheet looks like and that the formula is there and that it shows "0".
- NikolinoDEJun 07, 2023Gold ContributorIs it possible to have a file (without sensitive data) so that you don't necessarily have to recreate all this. You can embed the file here in the forum, or if it's not possible send me a private message (see my profile/message). Thx in advance.
- TreetrunksMMJun 07, 2023Copper ContributorI can't, sorry. It's on a work computer that isn't connected to the internet and I don't have a way to transfer anything to my phone from the computer on hand.