+ Reply to Thread
Results 1 to 6 of 6

Problem in Countifs with date field criteria

  1. #1
    Registered User
    Join Date
    02-13-2022
    Location
    Mumbai
    MS-Off Ver
    2019
    Posts
    3

    Problem in Countifs with date field criteria

    Hi,

    I'm trying to count the number of records for a month (from 1st of month to end of month) using the COUNTIFS function:
    =COUNTIFS(TradeLog[Trade Date],">="&C1,TradeLog[Trade Date],"<="&EOMONTH(C3,0))
    The dates in the reference range are derived from Vlookup formula and formatted as 'dd-mm-yyyy'. But this is not working for me and always returning 0.
    I have highlighted the field where this formula is used in the 'Monthly Summary' field in yellow.
    When i use the COUNTIF function for non-date numeric criteria, it is working fine, but then again i need to combine it with the date criteria ultimately.
    I'll be obliged if anyone can help me spot the cause of this so this can be fixed.

    Thanks & Regards,
    Shriram
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,369

    Re: Problem in Countifs with date field criteria

    Welcome to the forum.

    Your COUNTIFS is not going to work.

    Explain in WORDS what the calculation is that you wish to carry out and on which data, then attach the workbook again with manually calculated results added (not a non-working formula).

    Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft? Excel? for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,005

    Re: Problem in Countifs with date field criteria

    Dates in "Tradelog" are text

    in B3

    =DATEVALUE(VLOOKUP($A3,Details!$B:$T,13,0))

    Copy down and format as "dd-mmm-yy"

    and then

    =COUNTIFS(TradeLog[Trade Date],">="&C1,TradeLog[Trade Date],"<="&EOMONTH(C1,0))

    =COUNTIFS(TradeLog[Net P&L],">0.1",TradeLog[Trade Date],">" & C1)
    Last edited by JohnTopley; 02-13-2022 at 08:15 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Registered User
    Join Date
    02-13-2022
    Location
    Mumbai
    MS-Off Ver
    2019
    Posts
    3

    Re: Problem in Countifs with date field criteria

    Hi AliGW,

    I'm trying to count the number of entries in the TradeLog sheet for a given month. In the current case there 28 entries in TradeLog sheet which are between 1-Feb-2022 and 28-Feb-2022.
    So i want the count 28 to be displayed in the field where COUNTIFS formula is applied (yellow colored field in sheet Monthly Summary).
    I have updated the workbook as suggested. Please check and help.

    Thanks & Regards,
    Shriram
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-13-2022
    Location
    Mumbai
    MS-Off Ver
    2019
    Posts
    3

    Re: Problem in Countifs with date field criteria

    Thanks a LOT John!!!
    This has worked perfectly. The problem was the date format in the reference range. Thanks for suggesting the fix, much appreciated.

    Kind Regards,
    Shriram
    Last edited by AliGW; 02-13-2022 at 08:23 AM. Reason: PLEASE don't quote unnecessarily!

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,369

    Re: Problem in Countifs with date field criteria

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Format for Countifs specifc data AND date field
    By iankerry in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 05-24-2021, 12:12 PM
  2. Sum and Countifs with multiple Criteria problem
    By escalryan in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-09-2020, 11:19 AM
  3. COUNTIFS Formula Criteria Problem
    By hammer2 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-12-2018, 10:58 PM
  4. [SOLVED] Problem with countifs formula using two text criteria
    By adam_d_john in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-04-2017, 12:44 PM
  5. Using a drop down list field to determine a criteria in Countifs function - need ALL
    By luciedefreitas in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-26-2014, 09:57 AM
  6. Problem with Countifs with 3 criteria (one being date)
    By Akbhat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-31-2013, 08:42 AM
  7. Replies: 9
    Last Post: 12-09-2012, 08:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1