+ Reply to Thread
Results 1 to 11 of 11

Counting all records within a month based on a date

  1. #1
    Forum Contributor
    Join Date
    05-02-2017
    Location
    NoVa, United States
    MS-Off Ver
    Microsoft 365
    Posts
    154

    Counting all records within a month based on a date

    Okay, so I have another one. I'm trying to count all the people who have a term date within a certain month. That month will change and will be listed as of the end of the month. So, for August, the date is August 31, 2023. I'm looking for everyone with an August 2023 date.

    The formula I currently have is in G3. It's =COUNTIF(B:B,TEXT(G1,"MM/YYYY")) and it's not working. It's bringing back 1 (probably because it's seeing the 8/31/2023 record). It should bring back 3.



    It's Friday and my brain isn't firing on all cylinders yet... What am I missing? I feel like it's something obvious.
    Attached Files Attached Files

  2. #2
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Counting all records within a month based on a date

    One way, please try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Counting all records within a month based on a date

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

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Counting all records within a month based on a date

    With Power Query, you can set a parameter as shown in cells G1:G2 for a table starting in A1. Your result is in F5

    Excel 2016 (Windows) 64 bit
    A
    B
    C
    D
    E
    F
    G
    1
    Name Date Test Date
    2
    John
    7/1/2023
    August 31, 2023
    3
    Jake
    8/15/2023
    4
    Jimmy
    8/31/2023
    Table1
    5
    Danny
    8/1/2023
    Count if EE in August
    3
    Sheet: Sheet1

    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Forum Contributor
    Join Date
    05-02-2017
    Location
    NoVa, United States
    MS-Off Ver
    Microsoft 365
    Posts
    154

    Re: Counting all records within a month based on a date

    So, that works. The issue I'm having is that I'm trying to attach additional criteria to the formula. So, for instance, I want to add Vol as a criteria and corporate as another criteria.

    I input this and it comes up with a value error:

    =SUM(((YEAR('Term Data'!$J$2:$J$1700)=YEAR($M$4))*(MONTH('Term Data'!$J$2:$J$1700)=MONTH($M$4)))*('Term Data'!I2:I1700)="VOL")*('Term Data'!B2:B1700)="Corporate")

    Edit: This is on a different worksheet.

  6. #6
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Counting all records within a month based on a date

    One try (without testing): The whole formula should between the brackets of SUM:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If that does not work, please upload a sample sheet with the error
    Last edited by HansDouwe; 08-25-2023 at 04:23 PM.

  7. #7
    Forum Contributor
    Join Date
    05-02-2017
    Location
    NoVa, United States
    MS-Off Ver
    Microsoft 365
    Posts
    154

    Re: Counting all records within a month based on a date

    I appreciate the help - it's producing a value error. I've duplicated (I think) the essential information on the workbook, attached.

    This is the formula I used (in order to save the file attached, I had to accept the correction).

    =SUM(((YEAR(Sheet2!B:B)=YEAR(G1))*(MONTH(Sheet2!B:B)=MONTH(G1))*(Sheet2!C:C)="VOL")*(Sheet2!D:D)="Corp"))
    Attached Files Attached Files

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Counting all records within a month based on a date

    This is same as my previous but with the conditions
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-02-2017
    Location
    NoVa, United States
    MS-Off Ver
    Microsoft 365
    Posts
    154

    Re: Counting all records within a month based on a date

    @FalmeRetired - that worked beautifully. Thank you.

    How the heck do you all learn how to do all these formulas?

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,435

    Re: Counting all records within a month based on a date

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

    Not all the brackets where correct placed and don't take the header in the formula.
    Attached Files Attached Files

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Counting all records within a month based on a date

    Quote Originally Posted by Phlegon_of_Tralles View Post
    @FalmeRetired - that worked beautifully. Thank you.

    How the heck do you all learn how to do all these formulas?
    Sorry for the delay. I've been away for the last several days.

    Glad it helps.

    RE: "How we learn all these formulas."
    I study the masters on this and other forums and propose solution when I think I have something that might be useful. I swear one of the fastest and most effective ways to learn a subject is to teach it. I have much to learn.

+ 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. Counting Employees by Month Based on Hire Date Until Made Inactive
    By bswinden in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-23-2022, 05:43 AM
  2. Counting records open as of end of month
    By Tim Moore in forum Excel General
    Replies: 2
    Last Post: 11-21-2014, 06:08 PM
  3. [SOLVED] Counting & summing value based on date/month
    By Jhon Mustofa in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-03-2014, 02:32 AM
  4. [SOLVED] Counting records based on date and time.
    By bandera in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-29-2013, 01:56 AM
  5. Counting data based on a date period eg. Month
    By jennyp in forum Excel General
    Replies: 3
    Last Post: 01-17-2008, 09:02 PM
  6. [SOLVED] Counting records within a month
    By JoAnn in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 11-22-2005, 02:20 PM
  7. Counting unique records based on date range
    By aspAddict in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-26-2005, 04:05 PM

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