Automate a table showing the total number of times the numbers are less than 18 and greater than 18 for each time per day

keranali

Rules Violation
Joined
Oct 4, 2010
Messages
234
Office Version
  1. 365
Platform
  1. Windows
Need to automate a table showing the total number of times the numbers are less than 18 and greater than 18 for each time per day. I tried ding this =COUNTIF(Data!C2:C395,"Morning")*COUNTIF(Data!D2:D395,"<18") but not working.

the project.xlsx
VWX
4TimeLess Than 18Greater Than 18
5Morning143440
6Midday00
7Afternoon00
8Evening00
Overview
Cell Formulas
RangeFormula
W5W5=COUNTIF(Data!C2:C395,"Morning")*COUNTIF(Data!D2:D395,"<18")
X5:X8X5=COUNTIF(Data!D:D, "Morning") - COUNTIF(Data!E:E, "<18")
W6:W8W6=COUNTIF(Data!C3:C396,"Morning")*COUNTIF(B3:B101,"<18")



the project.xlsx
BCD
1DateTimeNum
22-Jan-23Morning33
32-Jan-23Midday21
42-Jan-23Afternoon4
52-Jan-23Evening1
63-Jan-23Morning2
73-Jan-23Midday15
83-Jan-23Afternoon32
93-Jan-23Evening22
104-Jan-23Morning27
114-Jan-23Midday5
124-Jan-23Afternoon32
134-Jan-23Evening35
145-Jan-23Morning18
155-Jan-23Midday12
165-Jan-23Afternoon15
175-Jan-23Evening11
186-Jan-23Morning19
196-Jan-23Midday12
206-Jan-23Afternoon2
216-Jan-23Evening20
227-Jan-23Morning36
237-Jan-23Midday36
247-Jan-23Afternoon5
257-Jan-23Evening20
269-Jan-23Morning32
279-Jan-23Midday13
289-Jan-23Afternoon5
299-Jan-23Evening21
3010-Jan-23Morning18
3110-Jan-23Midday5
Data
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Adjust according to number of rows in Data:

Book1
EFG
2<18>18
3Morning15
4Midday62
5Afternoon52
6Evening25
Sheet4
Cell Formulas
RangeFormula
F3:F6F3=COUNTIFS($B$2:$B$31,$E3,$C$2:$C$31,"<18")
G3:G6G3=COUNTIFS($B$2:$B$31,$E3,$C$2:$C$31,">18")
 
Upvote 1
Solution
how about

=COUNTIFS(data!$C$2:$C$395,V2,data!$D$2:$D$395,"<"&18)

=COUNTIFS(data!$C$2:$C$395,V2,data!$D$2:$D$395,">"&18)

Book16
VWX
1TimeLess Than 18Greater Than 18
2Morning15
3Midday62
4Afternoon52
5Evening25
Sheet2
Cell Formulas
RangeFormula
W2:W5W2=COUNTIFS(data!$C$2:$C$395,V2,data!$D$2:$D$395,"<"&18)
X2:X5X2=COUNTIFS(data!$C$2:$C$395,V2,data!$D$2:$D$395,">"&18)
 
Upvote 1
you are welcome

you should also include an =
at the moment if the cell has 18 its ignored
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

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