+ Reply to Thread
Results 1 to 14 of 14

Count Date Based on Month

  1. #1
    Forum Contributor
    Join Date
    02-23-2015
    Location
    SG
    MS-Off Ver
    MS Excel 2019 & 365
    Posts
    241

    Count Date Based on Month

    What will be the formula to count dates (column) based on the same month and names them in order?
    e.g. 4 dates in Feb and 2 dates in Mar, the new column ID will be 1,2,3,4 for Feb and 1,2 for Mar. Thanks.

    and the ID will reset when the year changed.
    Last edited by cyliyu; 03-25-2022 at 09:08 PM.

  2. #2
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,423

    Re: Count Date Based on Month

    @cyliyu welcome to the forum

    Please read and refer to this link, how to upload attachments,follow mathod 2
    https://www.excelforum.com/the-water...his-forum.html

    Please add some manually calculated expected results
    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file.

    Post a small Excel sheet (not a picture) showing realistic & representative sample data WITHOUT confidential information
    (10-20 rows, not thousands...) and some manually calculated results. Just before posting, scroll down to GO ADVANCED, click,
    and then scroll down to MANAGE ATTACHMENTS and click again. Now follow the instructions at the top of that screen

  3. #3
    Forum Contributor
    Join Date
    02-23-2015
    Location
    SG
    MS-Off Ver
    MS Excel 2019 & 365
    Posts
    241

    Re: Count Date Based on Month

    Please see the attached file the sample.
    Attached Files Attached Files

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Count Date Based on Month

    Hi cyliyu,

    You can sort your column D using Custom Sort using the built in Jan, Feb, Mar... sort order. If you do that then column A could be =Row()-1 and pull it down.

    https://support.microsoft.com/en-us/...4-a02205834d72
    See this link for Custom Sort by date.

    OR...
    In A2 put this formula and pull it down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Reformat Column A to number...
    Last edited by MarvinP; 03-26-2022 at 12:18 AM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  5. #5
    Forum Contributor
    Join Date
    02-23-2015
    Location
    SG
    MS-Off Ver
    MS Excel 2019 & 365
    Posts
    241

    Re: Count Date Based on Month

    Thank you very much, MarvinP.

    The formula will renumber the rows in sequential form.
    Refer to the sample file, using the formula and expected outcomes.

    I created the column because when I used Pivot Table and filtered say, April as the Month, it displayed 5,6,7 (based on column A) instead of 1, 2, 3.
    Attached Files Attached Files

  6. #6
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,423

    Re: Count Date Based on Month

    ANS. POST#1
    Cell A2 formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ANS. POST#5
    Cell I2 formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by wk9128; 03-26-2022 at 12:54 AM.

  7. #7
    Forum Contributor
    Join Date
    02-23-2015
    Location
    SG
    MS-Off Ver
    MS Excel 2019 & 365
    Posts
    241

    Re: Count Date Based on Month

    Thanks, wk9128.

    The formula works great.

  8. #8
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,423

    Re: Count Date Based on Month

    @cyliyu You're Welcome. Glad to help . Thank You for the feedback and rep.

    If you finally get a solution please mark your thread as SOLVED:
    - Click Thread Tools above your first post,you will see the word PREFIX on the upper left, press the button to select [SOLVED] select "Mark your thread as Solved".

  9. #9
    Forum Contributor
    Join Date
    02-23-2015
    Location
    SG
    MS-Off Ver
    MS Excel 2019 & 365
    Posts
    241

    Re: Count Date Based on Month

    I've noticed that as more rows are added to the Table, the formula shows an error.
    The previous row with the same month will have the same number as the new row.
    Attachment 774181

  10. #10
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Count Date Based on Month

    Please try

    =COUNTIFS(D$2:[@Since],">"&EOMONTH(D2,-1),D$2:[@Since],"<="&EOMONTH(D2,0))
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    02-23-2015
    Location
    SG
    MS-Off Ver
    MS Excel 2019 & 365
    Posts
    241

    Re: Count Date Based on Month

    Thank you very much, Bo Ry.
    Your formula is really excellent.
    I suspect the sumproduct formula may not function effectively in Table.

  12. #12
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Count Date Based on Month

    SUMPRODUCT also works but the array formula calculates slower than COUNTIFS

    =SUMPRODUCT(--(TEXT(D$2:[@Since],"my")=TEXT(D2,"my")))

    =SUMPRODUCT(--(EOMONTH(+D$2:[@Since],0)=EOMONTH(D2,0)))

  13. #13
    Forum Contributor
    Join Date
    02-23-2015
    Location
    SG
    MS-Off Ver
    MS Excel 2019 & 365
    Posts
    241

    Re: Count Date Based on Month

    Quote Originally Posted by Bo_Ry View Post
    SUMPRODUCT also works but the array formula calculates slower than COUNTIFS

    =SUMPRODUCT(--(TEXT(D$2:[@Since],"my")=TEXT(D2,"my")))

    =SUMPRODUCT(--(EOMONTH(+D$2:[@Since],0)=EOMONTH(D2,0)))
    Noted with Thanks. Bo_Ry

  14. #14
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Count Date Based on Month

    Hi cyliyu,

    The newer attachment with the "Expected Result" would have gotten you a better answer much sooner in this thread.
    Sorry I missed the expectations in your question.

+ 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. Count of historical ticket by month based upon an open and closed date
    By Mr.TDP in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-14-2021, 12:14 AM
  2. Replies: 1
    Last Post: 04-25-2021, 05:50 AM
  3. Replies: 1
    Last Post: 02-28-2020, 04:15 AM
  4. month to date calculation based on month selection from list box
    By jamaludheen in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-06-2017, 06:00 AM
  5. [SOLVED] date formula that puts the first of the prior month based on which month it is
    By cmorten82 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-08-2015, 05:38 PM
  6. [SOLVED] Using SUMIFS to count the number of inquiries per month based on the date of inquiry
    By Tryin2Excel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-25-2014, 04:11 AM
  7. [SOLVED] VBA to identify the current month and previous month based on system date
    By ravikumar00008 in forum Excel General
    Replies: 10
    Last Post: 07-26-2012, 10:04 AM

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