+ Reply to Thread
Results 1 to 10 of 10

COUNTIFS, EOMONTH and TODAY :)

  1. #1
    Registered User
    Join Date
    06-11-2015
    Location
    Hong Kong
    MS-Off Ver
    2010
    Posts
    5

    COUNTIFS, EOMONTH and TODAY :)

    Hey,

    I would like to count all employed people(Employed) who graduated from uni (G) and received professional qualification (Q) during the month of May. So far this formula works well;

    =COUNTIFS('Sheet 2'!B:B,"Employed",'Sheet 2'!R:R,"G",'Sheet 2'!AB:AB,"Q",'Sheet 2'!Z:Z,">4/30/2015")

    However in order to avoid manually updating the "date" criteria every month when I update this sheet, I'd like to automate it. Therefore I want a formula/macro button that automatically counts the number employed gardautes who qualified over the past month (as of the end of the month).

    To do that, EOMONTH sounded perfect. Therefore I wrote this formula and thought it would work;

    =COUNTIFS('Sheet 2'!B:B,"Employed",'Sheet 2'!R:R,"G",'Sheet 2'!AB:AB,"Q",'Sheet 2'!Z:Z,">EOMONTH(TODAY(),-1)")

    However the function with eomonth part gives me the same wrong result no matter what changes I bring to the EOMONTH "month" part. regardless if it's -1, -10/-20 it gives me the same wrong answer. I don't know what went wrong ? My dates are all properly formatted.

    Also, a macro button that could help me update the month part of my function would be welcome too

    Any other ideas on how I could update that to automatically get the result I want is are welcome


    Please please help me thank you
    Thank you!

  2. #2
    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,926

    Re: COUNTIFS, EOMONTH and TODAY :)

    Hi, welcome to the forum

    My dates are all properly formatted.
    Are you sure? Just because you format a cell as Date, doesnt mean it will change a text entry that looks like a date - to a date.
    Test your dates with =ISNUMBER(cell-Ref)...a FALSE answer means text, and you will need to convert those cells to real dates

    Also, a macro button that could help me update the month part of my function would be welcome too
    Not really sure what you mean here?
    If you are using EOMONTH(TODAY(),-1), that should update by itself?

    I suggest you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    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

  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,147

    Re: COUNTIFS, EOMONTH and TODAY :)

    Try

    =SUMPRODUCT(--(Sheet2!B:B="Employed"),--(Sheet2!R:R="G"),--(Sheet2!AB:AB="Q"),--(MONTH(Sheet2!Z:Z)=MONTH(TODAY())-1))

  4. #4
    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,147

    Re: COUNTIFS, EOMONTH and TODAY :)

    or this ....

    =COUNTIFS(Sheet2!B:B,"Employed",Sheet2!R:R,"G",Sheet2!AB:AB,"Q",Sheet2!Z:Z,">" & B1)

    where B1=EOMONTH(TODAY(),-1)

    COUNTIFS does not like the volatile expression placed in B1

  5. #5
    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,926

    Re: COUNTIFS, EOMONTH and TODAY :)

    John, this pre-supposes that the dates are real dates?

    Also...
    COUNTIFS does not like the volatile expression placed in B1
    not sure what you mean by that?

  6. #6
    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,147

    Re: COUNTIFS, EOMONTH and TODAY :)

    Well, well!! I tried using COUNTIFS with EOMONTH and constantly failed with formula errors (??!!!). I have now retried it and it works! Not sure what was wrong in my earlier attempts so my previous comment was wrong.

    This worked OK.

    =COUNTIFS(Sheet2!B:B,"Employed",Sheet2!R:R,"G",Sheet2!AB:AB,"Q",Sheet2!Z:Z,">" & EOMONTH(TODAY(),-1))

  7. #7
    Registered User
    Join Date
    06-11-2015
    Location
    Hong Kong
    MS-Off Ver
    2010
    Posts
    5

    Re: COUNTIFS, EOMONTH and TODAY :)

    This worked OK.

    =COUNTIFS(Sheet2!B:B,"Employed",Sheet2!R:R,"G",Sheet2!AB:AB,"Q",Sheet2!Z:Z,">" & EOMONTH(TODAY(),-1))
    Thank you so much JohnTopley! You just saved my job, your formula works perfectly fine! Thats really exactly what I needed.

    thanks a lot

  8. #8
    Registered User
    Join Date
    06-11-2015
    Location
    Hong Kong
    MS-Off Ver
    2010
    Posts
    5

    Re: COUNTIFS, EOMONTH and TODAY :)

    Thanks for the ideas everyone

  9. #9
    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,926

    Re: COUNTIFS, EOMONTH and TODAY :)

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, 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 those who helped.

  10. #10
    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,926

    Re: COUNTIFS, EOMONTH and TODAY :)

    Happy to help and thanks for the feedback

+ 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: 10
    Last Post: 09-06-2023, 08:19 PM
  2. [SOLVED] Using greater than or less than today as a criteria in a countifs
    By santanicopandimonium in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2014, 02:48 AM
  3. [SOLVED] COUNTIFS using (TODAY()-5days) Filter or equivalent
    By Stymple Tweed in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-15-2013, 08:34 AM
  4. Replies: 0
    Last Post: 12-16-2011, 09:01 AM
  5. Replies: 3
    Last Post: 12-11-2007, 01:36 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