+ Reply to Thread
Results 1 to 12 of 12

Count cell only if date matches current month & year

  1. #1
    Registered User
    Join Date
    01-15-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Count cell only if date matches current month & year

    Hi,

    I need to count entries on a spread sheet that only includes month-to-date data. I have entries that include multiple months and years, which I need for other cells on the same sheet.

    How do I get excel to count only the current month's entries and input that number into a different cell? (e.g. only count January 2014's entries if it is currently January 2014). I tried to use the COUNTIF function with no luck, as I couldn't quiet get the coding right for counting the current month and year. I'd like to avoid using filters, as I want the count to be automated.

    Help is much appreciated!

    Thanks

  2. #2
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Count cell only if date matches current month & year

    there are to possible ways that come to mind

    one is to find the datenumber of the first of the current month and also the datenumber of the current date and then countif the dates that meet the criteria (being greater or equal to the first datenumber and less or equal to the second number)

    the other is to add a column containg the month() and year() and countif those date that match the current month and year

    a sample in excel would do a lot

  3. #3
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: Count cell only if date matches current month & year

    try this formula and change the range of your date column from a2:a10 to the one in your worksheet.


    Please Login or Register  to view this content.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Count cell only if date matches current month & year

    Try

    =COUNTIFS(A1:A100,">="&EOMONTH(TODAY(),-1)+1,A1:A100,"<="&EOMONTH(TODAY(),0))

  5. #5
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Count cell only if date matches current month & year

    Try

    =SUMPRODUCT(--(TEXT(A2:A10,"mmyyyy")=TEXT(TODAY(),"mmyyyy")))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  6. #6
    Registered User
    Join Date
    01-15-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Count cell only if date matches current month & year

    Quote Originally Posted by Ace_XL View Post
    Try

    =SUMPRODUCT(--(TEXT(A2:A10,"mmyyyy")=TEXT(TODAY(),"mmyyyy")))
    This worked perfectly, thanks!

    As a related question, how would I then only count that set of data IF another cell has a certain value? (ex: column A matches this month and year, AND column B is "Name")

    Thanks again!

  7. #7
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Count cell only if date matches current month & year

    Try..

    =SUMPRODUCT((TEXT(A2:A10,"mmyyyy")=TEXT(TODAY(),"mmyyyy"))*(B2:B10="Name"))

  8. #8
    Registered User
    Join Date
    01-15-2014
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Count cell only if date matches current month & year

    Quote Originally Posted by Ace_XL View Post
    Try..

    =SUMPRODUCT((TEXT(A2:A10,"mmyyyy")=TEXT(TODAY(),"mmyyyy"))*(B2:B10="Name"))
    That worked! Thanks for the quick response

  9. #9
    Registered User
    Join Date
    02-29-2012
    Location
    UK, Newcastle
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Count cell only if date matches current month & year

    Along similar lines I have the formula below and want to add another part to check the date entered into the same row in column H is equal to the date I enter into cell A1.

    Example cell A1 = Apr-14 so i want to only count if the date in column H is in the month and year of April 2014. The format of the date in H is dd/mm/yyyy

    many thanks

  10. #10
    Registered User
    Join Date
    02-29-2012
    Location
    UK, Newcastle
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Count cell only if date matches current month & year

    any one have any ideas for this one?

  11. #11
    Registered User
    Join Date
    06-28-2012
    Location
    delhi
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Count cell only if date matches current month & year

    On similar lines can we develop formula for a Quarter??

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,939

    Re: Count cell only if date matches current month & year

    jatin, welcome to the forum

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ 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. Replies: 4
    Last Post: 12-10-2013, 06:41 PM
  2. Replies: 3
    Last Post: 09-04-2013, 10:49 AM
  3. [SOLVED] count if date in another cell falls in certain month and year
    By ea223 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-18-2012, 07:17 PM
  4. Replies: 1
    Last Post: 08-13-2012, 11:18 AM
  5. Current Year & Month Name, Previous Year & Month Name
    By mithesh in forum Excel General
    Replies: 9
    Last Post: 10-21-2011, 07:00 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