Help to count cells in a time range that meet a condition

Alex Oliveira

New Member
Joined
May 3, 2019
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi there,



Please, I need help with this.



I have a series of hourly temperature data (C) for a year (N=8760) and I need to:



A) Count the number of cells (Column B) between this time range in a year: 01:00 to 08:00 AND 23:00 and 00:00.

I know the result is 2920 and would like to get that without using filter with SUBTOTAL.



B) Count the number of cells at the same time range that are lower than 30, in column C.

Year.xls
ABCDEFGHI
1Date/TimeHourTo (°C)Occupancy (Time ranges)1:00to8:00
2DORM123:00to0:00
301/01/2002 01:0001:0028,3
401/01/2002 02:0002:0027,7Criteria <30
501/01/2002 03:0003:0028,0
601/01/2002 04:0004:0028,3A)Count (Year)2920
701/01/2002 05:0005:0028,2B)Count If (Year) <30
801/01/2002 06:0006:0027,9
901/01/2002 07:0007:0027,8
1001/01/2002 08:0008:0027,9
1101/01/2002 09:0009:0028,6
1201/01/2002 10:0010:0029,4
1301/01/2002 11:0011:0030,1
1401/01/2002 12:0012:0030,7
1501/01/2002 13:0013:0031,2
1601/01/2002 14:0014:0031,6
1701/01/2002 15:0015:0031,9
1801/01/2002 16:0016:0032,3
1901/01/2002 17:0017:0032,5
2001/01/2002 18:0018:0032,4
2101/01/2002 19:0019:0031,9
2201/01/2002 20:0020:0031,3
2301/01/2002 21:0021:0030,7
2401/01/2002 22:0022:0030,2
2501/01/2002 23:0023:0029,9
2602/01/200200:0029,7
2702/01/2002 01:0001:0029,6
2802/01/2002 02:0002:0029,4
2902/01/2002 03:0003:0029,3
3002/01/2002 04:0004:0029,2
3102/01/2002 05:0005:0029,0
3202/01/2002 06:0006:0028,6
3302/01/2002 07:0007:0028,2
3402/01/2002 08:0008:0028,4
3502/01/2002 09:0009:0029,1
3602/01/2002 10:0010:0029,9
3702/01/2002 11:0011:0030,6
3802/01/2002 12:0012:0031,1
3902/01/2002 13:0013:0031,6
4002/01/2002 14:0014:0032,0
4102/01/2002 15:0015:0032,5
4202/01/2002 16:0016:0032,9
4302/01/2002 17:0017:0033,2
4402/01/2002 18:0018:0033,1
4502/01/2002 19:0019:0032,5
4602/01/2002 20:0020:0031,8
4702/01/2002 21:0021:0031,1
4802/01/2002 22:0022:0030,5
4902/01/2002 23:0023:0030,3
5003/01/200200:0029,4
L


I have been working with that, obtaining a partial solution using COUNT.IFS for a day (just one time interval), but when I have a year and different time intervals in a day….



Best regards,
 

Attachments

  • Year.jpg
    Year.jpg
    142.2 KB · Views: 5

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
How about
Note that I2 needs to be 1 or 24:00:00
Fluff.xlsm
ABCDEFGHI
1Date/TimeHourTo (°C)Occupancy (Time ranges)01:00:00to08:00:00
2DORM123:00:00to1
301/01/2002 01:0001:00:0028.32386
401/01/2002 02:0002:00:0027.66525Criteria <30
501/01/2002 03:0003:00:0027.95425
601/01/2002 04:0004:00:0028.30235A)Count (Year)92920
701/01/2002 05:0005:00:0028.16119B)Count If (Year) <309
801/01/2002 06:0006:00:0027.94404
901/01/2002 07:0007:00:0027.79674
1001/01/2002 08:0008:00:0027.88345
1101/01/2002 09:0009:00:0028.6077
1201/01/2002 10:0010:00:0029.4043
1301/01/2002 11:0011:00:0030.06572
1401/01/2002 12:0012:00:0030.68637
1501/01/2002 13:0013:00:0031.17154
1601/01/2002 14:0014:00:0031.55785
1701/01/2002 15:0015:00:0031.91505
1801/01/2002 16:0016:00:0032.30765
1901/01/2002 17:0017:00:0032.53089
2001/01/2002 18:0018:00:0032.40727
2101/01/2002 19:0019:00:0031.93529
2201/01/2002 20:0020:00:0031.30671
2301/01/2002 21:0021:00:0030.69806
2401/01/2002 22:0022:00:0030.17499
2501/01/2002 23:0023:00:0029.87052
2602/01/2002 00:0000:00:0029.7454
2702/01/2002 01:0001:00:0029.56661
2802/01/2002 02:0002:00:0029.35742
2902/01/2002 03:0003:00:0029.32743
3002/01/2002 04:0004:00:0029.22023
3102/01/2002 05:0005:00:0028.97587
3202/01/2002 06:0006:00:0028.62246
3302/01/2002 07:0007:00:0028.20633
3402/01/2002 08:0008:00:0028.43674
3502/01/2002 09:0009:00:0029.11732
3602/01/2002 10:0010:00:0029.85921
3702/01/2002 11:0011:00:0030.55506
3802/01/2002 12:0012:00:0031.12852
3902/01/2002 13:0013:00:0031.55282
4002/01/2002 14:0014:00:0031.98317
4102/01/2002 15:0015:00:0032.45958
4202/01/2002 16:0016:00:0032.94049
4302/01/2002 17:0017:00:0033.20225
4402/01/2002 18:0018:00:0033.06796
4502/01/2002 19:0019:00:0032.53275
4602/01/2002 20:0020:00:0031.80678
4702/01/2002 21:0021:00:0031.11744
4802/01/2002 22:0022:00:0030.53304
4902/01/2002 23:0023:00:0030.34689
5003/01/2002 00:0000:00:0029.39266
Database
Cell Formulas
RangeFormula
G6G6=COUNT(FILTER(B3:B50,((B3:B50>=G1)*(B3:B50<=I1))+((B3:B50>=G2)*(B3:B50<=I2))))
G7G7=COUNT(FILTER(B3:B50,((C3:C50<30)*(B3:B50>=G1)*(B3:B50<=I1))+((C3:C50<30)*(B3:B50>=G2)*(B3:B50<=I2))))
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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