• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
    • Password Reset
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member

CountIFS when trying to calculate number of equal or less than dates compared to another date|General Excel Questions & Answers|Excel Forum|My Online Training Hub

You are here: Home / CountIFS when trying to calculate number of equal or less than dates compared to another date|General Excel Questions & Answers|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumGeneral Excel Questions & Answe…CountIFS when trying to calculate n…
sp_PrintTopic sp_TopicIcon
CountIFS when trying to calculate number of equal or less than dates compared to another date
Avatar
Gary Buglass
Member
Members
Level 0
Forum Posts: 9
Member Since:
June 21, 2020
sp_UserOfflineSmall Offline
1
July 13, 2020 - 7:54 pm
sp_Permalink sp_Print

Would appreciate some help on creating the correct formula as I keep getting this wrong somewhere.

I have three date columns as below but would like to count how many entries are either completed on the Date for Completion or sooner based upon dates in the "Due Completion" column and "Date Complete" entries with the total count being returned in F14 which is currently 4.

This is what I have as the formula that is returning the total 4 at the moment, but it doesn't seem to return the correct total of entries that is equal to or less than the due date for completion.

the correct total should be 5 

=COUNTIFS($H21:$H31,"<="&$E21,$E21:$E31,"<="&$E21)

Any guidance on what is wrong with the formula or where I am going wrong would be appreciated.

 

  D E F G H
      Summary Status Performance
      4 Closed within scheduled due date  
      3 Open
      6 Closed
           
           
           
  Date Raised Due Completion Date Raised By Pending Actions Date Complete
21 24 Apr 2020 29-May-20     29 May 2020
22 24 Apr 2020 29-May-20     02 Jun 2020
23 29 Apr 2020 04-May-20     05 May 2020
24 15 May 2020 15-May-20     16 May 2020
25 15 May 2020 29-May-20     15 May 2020
26 08 Jul 2020 13-Jul-20     10 Jul 2020
27 30 Jun 2020 06-Jul-20     06 Jul 2020
28 30 Jun 2020 30-Jun-20     30 Jun 2020
29 30 Jun 2020 27-Nov-20      
30          
           
sp_AnswersTopicSeeAnswer See Answer
Avatar
Philip Treacy
Admin
Level 10
Forum Posts: 1518
Member Since:
October 5, 2010
sp_UserOfflineSmall Offline
2
July 13, 2020 - 8:02 pm
sp_Permalink sp_Print

Hi Gary,

Can you attach your workbook please so we don't have to type in your data.

Thanks

Phil

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 627
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
3
July 13, 2020 - 8:19 pm
sp_Permalink sp_Print

Where do you get 5 from? Only the first 5 rows have a due date less than or equal to 29-May-20 and the actual completion date in row 22 is after 29-May-20 so it is excluded, leaving 4.

Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 871
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
4
July 13, 2020 - 9:32 pm
sp_Permalink sp_Print

Hello,

Based on your formula, where you check if the dates in column H is less than or equal to the date in cell E21, the result of four is correct.

But in my view you should check the Date Complete against Due Completion Date for each row, so in cell I21 put in this formula: =IF(ISBLANK(H21),"",H21<=E21) and drag (copy) down.

It will result in a TRUE or FALSE if there is data in H21 (else empty) and then you just count the number of TRUE's.
=COUNTIF(I21:I31,TRUE)

Then you get five as a result.

Br,
Anders

Avatar
Gary Buglass
Member
Members
Level 0
Forum Posts: 9
Member Since:
June 21, 2020
sp_UserOfflineSmall Offline
5
July 14, 2020 - 4:13 pm
sp_Permalink sp_Print

Thanks guys, what I am trying to do is count the instances where an event is completed on the due date or before it, so checking if the task was completed on time by the due date or sooner compared to the row entry against the due completion date. 

Avatar
Gary Buglass
Member
Members
Level 0
Forum Posts: 9
Member Since:
June 21, 2020
sp_UserOfflineSmall Offline
6
July 14, 2020 - 4:42 pm
sp_Permalink sp_Print

Velouria said
Where do you get 5 from? Only the first 5 rows have a due date less than or equal to 29-May-20 and the actual completion date in row 22 is after 29-May-20 so it is excluded, leaving 4.  

In the example above, Row 22 is not equal or less than :   2nd June is after the due completion date of 29 May 

 

Attached the excel book to this post.

Using the attached file, Is there one formula that can be used to get the final count in one step within cell D14 or will it be necessary to follow Anders suggestion and count the true or false statements in a hidden column.

Is this formula now correct :

=COUNTIFS($F21:$F33,"<="&$C21,$C21:$C33,"<="&$C21)

Avatar
Gary Buglass
Member
Members
Level 0
Forum Posts: 9
Member Since:
June 21, 2020
sp_UserOfflineSmall Offline
7
July 14, 2020 - 4:57 pm
sp_Permalink sp_Print

Further to my last post, when inserting new rows, this formula doesn't seem to work, something not right here.. 

Avatar
Velouria
London or thereabouts
Moderator
Members


Trusted Members

Moderators
Level 4
Forum Posts: 627
Member Since:
November 1, 2018
sp_UserOfflineSmall Offline
8
July 14, 2020 - 6:47 pm
sp_Permalink sp_Print

Gary Buglass said

In the example above, Row 22 is not equal or less than :   2nd June is after the due completion date of 29 May 

I know - that's what I said. 🙂

 

It looks to me like you just need:

=SUMPRODUCT((F21:F30<=C21:C30)*(F21:F30<>""))

sp_AnswersTopicAnswer
Answers Post
Avatar
Anders Sehlstedt
Eskilstuna, Sweden

VIP
Members


Trusted Members
Level 3
Forum Posts: 871
Member Since:
December 7, 2016
sp_UserOfflineSmall Offline
9
July 15, 2020 - 4:05 am
sp_Permalink sp_Print

Thanks Velouria! I learned a new use of SUMPRODUCT.

Br,
Anders

Avatar
Gary Buglass
Member
Members
Level 0
Forum Posts: 9
Member Since:
June 21, 2020
sp_UserOfflineSmall Offline
10
July 15, 2020 - 4:38 pm
sp_Permalink sp_Print sp_EditHistory

Thanks very much, your help is very appreciated.  I seem to have learned lots from this forum in the short time I have been a member.  Thank you to everyone.

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Jeanine Hagge
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 871
Purfleet: 412
Frans Visser: 346
David_Ng: 306
lea cohen: 219
Jessica Stewart: 205
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Othman AL MUTAIRI
Misael Gutierrez Sr.
Attif Ihsan
Kieran Fee
Murat Hasanoglu
Brett Dryland
Saeed Aldousari
Bhuwan Devkota
Kathryn Patton
Maria Conatser
Forum Stats:
Groups: 3
Forums: 24
Topics: 6222
Posts: 27293

 

Member Stats:
Guest Posters: 49
Members: 31917
Moderators: 3
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: MOTH Support, Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook
 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.