+ Reply to Thread
Results 1 to 13 of 13

Count Formula with Criteria

  1. #1
    Registered User
    Join Date
    03-08-2011
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Count Formula with Criteria

    Hey,

    Attached is what I am trying to do (just an example). I am having difficulty getting the date range to work. Any ideas? There are two sheets used. Sheet 1 and Sheet 2. I am using Sheet 2 to run summarys automatically when data is put into sheet 1.



    J
    Attached Files Attached Files
    Last edited by NBVC; 03-08-2011 at 02:16 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Formula with Criteria

    try:

    =SUMPRODUCT(--(TEXT(Sheet1!$A$2:$A$8,"mmmm")=C$3),--(Sheet1!$B$2:$B$8=TRIM(LEFT($C4,FIND(" ",$C4)))))

    but not sure if year would be important too.

    Also, avoid merged cells if you intend to have February, March, etc totals in adjacent columns.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    03-08-2011
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Count Formula with Criteria

    Can you not use CountIfs since the objects I am counting are words not numbers?

    Can you re-attach the excel sheet with your suggestion?

    Also, would it be smart to include the start date and the end date on sheet 2 to absolute cell reference? Each Month will have its own sheet.
    Last edited by jlclark4; 03-08-2011 at 10:27 AM.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Formula with Criteria

    I have attached a sample with 2 scenarios.

    1. The Sumproduct version I showed.

    2. Using Countifs. With this you need to enter a date in the header (formatted as "mmmm" if you want to see month only).
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-08-2011
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Count Formula with Criteria

    I am more of a visual person, thanks for the examples. The lightbulb just went off. I was having a hard time understanding the "mmmm" thing you were talking about. Figured out it was a custom format.

    Thanks!

  6. #6
    Registered User
    Join Date
    03-08-2011
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Count Formula with Criteria

    Still having trouble getting it to work with my actual file. In my actual file, I do not use the word "Total". Its group of words. I noticed the formula you gave was isolating Bill from Bill total. Tried to re work it and failed

    :/

    Can you help?!
    Attached Files Attached Files

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Formula with Criteria

    In that case, the formulas are much cleaner:

    In D4:

    =SUMPRODUCT(--(TEXT(Data!$A$2:$A$8,"mmmm")=D$3),--(Data!$B$2:$B$8=$C4))

    and in I4:

    =COUNTIFS(Data!$A$2:$A$8,">="&I$3,Data!$A$2:$A$8,"<="&EOMONTH(I$3,0),Data!$B$2:$B$8,$H4)

  8. #8
    Registered User
    Join Date
    03-08-2011
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Count Formula with Criteria

    Blah, It works fine in your examples but I can not get it to work in my spreadsheet. Do you have any other ideas?

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Formula with Criteria

    Check for extra spaces in the columns and cells with the names you're referencing. There could be extra spaces, etc.

  10. #10
    Registered User
    Join Date
    03-08-2011
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Count Formula with Criteria

    I believe the issue is the data. I am exporting from access and the date field isnt converting properly.

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Count Formula with Criteria

    Try perhaps selecting that column of dates. Go to Data|Text to Columns and skip to 3rd window. Select Date from the data column format area, and in adjacent drop down, select the appropriate format you column should be showing in...

    Click Finish.

    Does that fix anything?

  12. #12
    Registered User
    Join Date
    03-08-2011
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Count Formula with Criteria

    BINGO!

    Now, let me try this forumla again.

  13. #13
    Registered User
    Join Date
    03-08-2011
    Location
    North Carolina, US
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Count Formula with Criteria

    That was the problem. Thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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