COUNTIFS Between Dates Not Working

jski21

Board Regular
Joined
Jan 2, 2019
Messages
155
Office Version
  1. 2016
Platform
  1. Windows
Good day Mr. Excel Team,

Struggling with getting my COUNTIFS formula in Cell I20 to work. The result should be 4 but it's returning 0. Cells are formatted as dates so what am I missing?

Mr Excel.xlsx
ABCDEFGHIJKL
1
2Expenses Tab
3Max date:10-21-2021
4Min date:08-27-2014Date (MM-DD-YYYY)Store / Vendor$ AmountExpense Category
52/22/20216320 - Professional Services$5,939.81AAA
6Income Tab2/22/20216320 - Professional Services$11,815.00BBB
7Max date:01-00-19002/22/20216320 - Professional Services$36,601.29BBB
8Min date:01-00-19003/30/20216320 - Professional Services$57,902.13CCC
910/21/20216320 - Professional Services$3,105.16BBB
1010/21/20216320 - Professional Services$7,322.51BBB
11Overall Time Period
12
13Transaction DatesExpensesIncomeOverallMonthYear
14Oldest08-27-2014na08-27-201482014
15Newest10-21-2021na10-21-2021102021
16
17
18Dashboard Time PeriodsBBBAAACCC
19
20PeriodStart DateEnd DateTextCount000
21Latest month10-01-202110-31-2021Latest month (Oct-21)Average
22Last 3 months08-01-202110-31-2021Last 3 months (Aug-21 to Oct-21)Maximum
23Last 6 months05-01-202110-31-2021Last 6 months (May-21 to Oct-21)Minimum
24Last 12 months11-01-202010-31-2021Last 12 months (Nov-20 to Oct-21)
25Year to date01-01-202110-31-2021Year to date (Jan-21 to Oct-21)
26All08-27-201410-21-2021All (Aug-14 to Oct-21)
27
28Selected time period# of months
294Last 12 months11-01-202010-31-202112.00
30
31Selected Label:(12 months)
Date Info
Cell Formulas
RangeFormula
C3C3=MAX(IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!B:B>0,IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!F:F<>"Y",'\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!B:B)))
C4C4=MIN(IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!B:B>0,IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!F:F<>"Y",'\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!B:B)))
C7C7=MAX(IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!B:B>0,IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!F:F<>"Y",'\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!B:B)))
C8C8=MIN(IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!B:B>0,IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!F:F<>"Y",'\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!B:B)))
C14C14=IF('Date Info'!C4=0,"na",'Date Info'!C4)
D14D14=IF('Date Info'!C8=0,"na",'Date Info'!C8)
E14E14=IF(MIN(C14:D14)=0,"na",MIN(C14:D14))
F14:F15F14=IFERROR(MONTH(E14),"na")
G14:G15G14=IFERROR(YEAR(E14),"na")
C15C15=IF('Date Info'!C3=0,"na",'Date Info'!C3)
D15D15=IF('Date Info'!C7=0,"na",'Date Info'!C7)
E15E15=IF(MAX(C15:D15)=0,"na",MAX(C15:D15))
I20I20=COUNTIFS(L5:L10,I18,I5:I10,”>=”&C29,I5:I10,”<=”&D29)
J20J20=COUNTIFS(L5:L10,J18,I5:I10,”>=”&C29,I5:I10,”<=”&D29)
L20L20=COUNTIFS(L5:L10,K18,I5:I10,”>=”&C29,I5:I10,”<=”&D29)
C21C21=IFERROR(DATE(YEAR(D21),MONTH(D21),1),"na")
D21D21=IFERROR(EOMONTH(E15,0),"na")
E21E21=B21&" ("&TEXT(C21,"mmm-yy")&")"
C22C22=IFERROR(DATE(YEAR(D22),MONTH(D22)-2,1),"na")
D22:D25D22=$D$21
E22:E26E22=B22&" ("&TEXT(C22,"mmm-yy")&" to "&TEXT(D22,"mmm-yy")&")"
C23C23=IFERROR(DATE(YEAR(D23),MONTH(D23)-5,1),"na")
C24C24=IFERROR(DATE(YEAR(D24),MONTH(D24)-11,1),"na")
C25C25=IFERROR(DATE(YEAR(D25),1,1),"na")
C26C26=E14
D26D26=E15
A29A29='\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Dashboard'!B3
B29B29=OFFSET(B$20,$A29,0)
C29C29=IFERROR(IF($A$29<7,DATE(YEAR(OFFSET(C$20,$A29,0)),MONTH(OFFSET(C$20,$A29,0)),1),OFFSET(C$20,$A29,0)),"na")
D29D29=IFERROR(IF($A$29<7,EOMONTH(OFFSET(D$20,$A29,0),0),OFFSET(D$20,$A29,0)),"na")
E29E29=IFERROR(MAX(((YEAR(D29)-YEAR(C29))*12+MONTH(D29)-MONTH(C29)+1),1),1)
C31C31="("&IF(ROUND($E$29,0)=1,TEXT($E$29,"#,##0")&" month",TEXT($E$29,"#,##0")&" months")&")"
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Data Validation
CellAllowCriteria
I5:I10Date>1/1/1900




Thanks in adavance for the look/see and advice.


jski
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Change I5:I10 to General format, what do you see?
 
Upvote 0
Thanks Fluff....no change:

Mr Excel.xlsx
ABCDEFGHIJKL
1
2Expenses Tab
3Max date:10-21-2021
4Min date:08-27-2014Date (MM-DD-YYYY)Store / Vendor$ AmountExpense Category
5442496320 - Professional Services$5,939.81AAA
6Income Tab442496320 - Professional Services$11,815.00BBB
7Max date:01-00-1900442496320 - Professional Services$36,601.29BBB
8Min date:01-00-1900442856320 - Professional Services$57,902.13CCC
9444906320 - Professional Services$3,105.16BBB
10444906320 - Professional Services$7,322.51BBB
11Overall Time Period
12
13Transaction DatesExpensesIncomeOverallMonthYear
14Oldest08-27-2014na08-27-201482014
15Newest10-21-2021na10-21-2021102021
16
17
18Dashboard Time PeriodsBBBAAACCC
19
20PeriodStart DateEnd DateTextCount000
21Latest month10-01-202110-31-2021Latest month (Oct-21)Average
22Last 3 months08-01-202110-31-2021Last 3 months (Aug-21 to Oct-21)Maximum
23Last 6 months05-01-202110-31-2021Last 6 months (May-21 to Oct-21)Minimum
24Last 12 months11-01-202010-31-2021Last 12 months (Nov-20 to Oct-21)
25Year to date01-01-202110-31-2021Year to date (Jan-21 to Oct-21)
26All08-27-201410-21-2021All (Aug-14 to Oct-21)
27
28Selected time period# of months
294Last 12 months11-01-202010-31-202112.00
30
31Selected Label:(12 months)
Date Info
Cell Formulas
RangeFormula
C3C3=MAX(IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!B:B>0,IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!F:F<>"Y",'\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!B:B)))
C4C4=MIN(IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!B:B>0,IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!F:F<>"Y",'\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Expenses'!B:B)))
C7C7=MAX(IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!B:B>0,IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!F:F<>"Y",'\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!B:B)))
C8C8=MIN(IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!B:B>0,IF('\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!F:F<>"Y",'\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Income'!B:B)))
C14C14=IF('Date Info'!C4=0,"na",'Date Info'!C4)
D14D14=IF('Date Info'!C8=0,"na",'Date Info'!C8)
E14E14=IF(MIN(C14:D14)=0,"na",MIN(C14:D14))
F14:F15F14=IFERROR(MONTH(E14),"na")
G14:G15G14=IFERROR(YEAR(E14),"na")
C15C15=IF('Date Info'!C3=0,"na",'Date Info'!C3)
D15D15=IF('Date Info'!C7=0,"na",'Date Info'!C7)
E15E15=IF(MAX(C15:D15)=0,"na",MAX(C15:D15))
I20I20=COUNTIFS(L5:L10,I18,I5:I10,”>=”&C29,I5:I10,”<=”&D29)
J20J20=COUNTIFS(L5:L10,J18,I5:I10,”>=”&C29,I5:I10,”<=”&D29)
L20L20=COUNTIFS(L5:L10,K18,I5:I10,”>=”&C29,I5:I10,”<=”&D29)
C21C21=IFERROR(DATE(YEAR(D21),MONTH(D21),1),"na")
D21D21=IFERROR(EOMONTH(E15,0),"na")
E21E21=B21&" ("&TEXT(C21,"mmm-yy")&")"
C22C22=IFERROR(DATE(YEAR(D22),MONTH(D22)-2,1),"na")
D22:D25D22=$D$21
E22:E26E22=B22&" ("&TEXT(C22,"mmm-yy")&" to "&TEXT(D22,"mmm-yy")&")"
C23C23=IFERROR(DATE(YEAR(D23),MONTH(D23)-5,1),"na")
C24C24=IFERROR(DATE(YEAR(D24),MONTH(D24)-11,1),"na")
C25C25=IFERROR(DATE(YEAR(D25),1,1),"na")
C26C26=E14
D26D26=E15
A29A29='\\CD-SRV2\Budget_Accounting\Jski\Excel\[Public Works Dashboard.xlsx]Dashboard'!B3
B29B29=OFFSET(B$20,$A29,0)
C29C29=IFERROR(IF($A$29<7,DATE(YEAR(OFFSET(C$20,$A29,0)),MONTH(OFFSET(C$20,$A29,0)),1),OFFSET(C$20,$A29,0)),"na")
D29D29=IFERROR(IF($A$29<7,EOMONTH(OFFSET(D$20,$A29,0),0),OFFSET(D$20,$A29,0)),"na")
E29E29=IFERROR(MAX(((YEAR(D29)-YEAR(C29))*12+MONTH(D29)-MONTH(C29)+1),1),1)
C31C31="("&IF(ROUND($E$29,0)=1,TEXT($E$29,"#,##0")&" month",TEXT($E$29,"#,##0")&" months")&")"
Press CTRL+SHIFT+ENTER to enter array formulas.
Cells with Data Validation
CellAllowCriteria
I5:I10Date>1/1/1900
 
Upvote 0
Missed it initially, you have the wrong type of quotes in the formula, they should be " and not ”
 
Upvote 0
Solution
Try changing your double quotes

=COUNTIFS(L5:L10,I18,I5:I10,>=&C29,I5:I10,<=&D29)

to

=COUNTIFS(L5:L10,I18,I5:I10,">="&C29,I5:I10,"<="&D29)
 
Upvote 0
For cryin' out loud...it's always the subatomic particle detail that always makes the biggest difference. Thank you both for the help. Now another issue: Who do I give the credit too? :)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
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