Trying to count if time falls between two times using a time generated from Text function

Theneoalchemist

New Member
Joined
Mar 6, 2020
Messages
5
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi everyone,

I have been searching for a way to have Excel count number of entries between two times from a data set.

The issue is that the data set I receive has column "A" set as "mm,dd,yyyy HH:MM". So I created a different column ( "I" ) that is pulling the time utilizing =If(A2="","",Text(A2,"hh:mm")). Then I have another cell that has the function =Countifs(I:I,">=00:00",I:I,"<=06:00"). The problem is that it keeps returning a result of 0. If I go into the I column and manually type a time, for instance "06:43" then the counter will increase to 1.

Is there something else that I need to be doing?
 

Attachments

  • excel 1.JPG
    excel 1.JPG
    95.9 KB · Views: 11

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi everyone,

I have been searching for a way to have Excel count number of entries between two times from a data set.

The issue is that the data set I receive has column "A" set as "mm,dd,yyyy HH:MM". So I created a different column ( "I" ) that is pulling the time utilizing =If(A2="","",Text(A2,"hh:mm")). Then I have another cell that has the function =Countifs(I:I,">=00:00",I:I,"<=06:00"). The problem is that it keeps returning a result of 0. If I go into the I column and manually type a time, for instance "06:43" then the counter will increase to 1.

Is there something else that I need to be doing?
hi
what you mean by "count number of entries between two times" you mean count number of entries during a specific time or something else... explaine and if possible for you attach the excel file
 
Upvote 0
Given that times and dates are stored as numeric values, you could use numeric functions to split them instead of coercing text.

Time only =IF(A2="","",MOD(A2,1))
Date only =IF(A2="","",INT(A2))

Text coercion requires 2 additional calculations per non-blank cell.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,847
Members
449,051
Latest member
excelquestion515

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