Count number of cells after a time range in one column and before a time range in another column

swannylfc

New Member
Joined
Aug 4, 2014
Messages
27
Hi,

I have two columns in the format d/mm/yy hh:mm - e.g. 8/05/17 16:00.

One column - A - is the expiry time of a ticket while the other column - B - is the transaction time of the ticket.

Given a time I enter into C1 (same format as above), I want to count the amount of transactions that expire after C1, and of those I want to exclude any transactions that occur after C1.

I have tried the following formula which is only returning 0.
Code:
=COUNTIFS(A1:A100, A1>C1, B1:B100, B1 < C1)

I would love any assistance anyone can provide on this.

Much appreciated and warm regards.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
try this =COUNTIFS(A1:A100, ">" & C1, B1:B100, "< " & C1) . formula in d2 returns 2

8/05/2017 16:006/05/2017 16:007/05/2017 16:002
8/05/2017 16:007/05/2017 16:00
8/05/2017 16:008/05/2017 16:00
8/05/2017 16:009/05/2017 16:00
8/05/2017 16:0010/05/2017 16:00
8/05/2017 16:0011/05/2017 16:00
8/05/2017 16:0012/05/2017 16:00
8/05/2017 16:0013/05/2017 16:00

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
try this =COUNTIFS(A1:A100, ">" & C1, B1:B100, "< " & C1) . formula in d2 returns 2

8/05/2017 16:006/05/2017 16:007/05/2017 16:002
8/05/2017 16:007/05/2017 16:00
8/05/2017 16:008/05/2017 16:00
8/05/2017 16:009/05/2017 16:00
8/05/2017 16:0010/05/2017 16:00
8/05/2017 16:0011/05/2017 16:00
8/05/2017 16:0012/05/2017 16:00
8/05/2017 16:0013/05/2017 16:00

<tbody>
</tbody>

Excellent! Does exactly what I required. Thank you for your prompt and helpful response!
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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