+ Reply to Thread
Results 1 to 9 of 9

COUNTIFS is not calculating correctly

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    138

    COUNTIFS is not calculating correctly

    I have attached a spreadsheet that is not calculating for some reason and I cannot figure out why. I have 5 other workbooks identical to this one where they calculate fine and this one will not. I'm pulling my hair out trying to find a difference.

    The formula that is not working is on the sheet Site Visit Summary H20 -H29 and J20 - J29

    More specifically J25 should be returning a value of 1.

    I appreciate any guidance on this.

    Thanks!
    Attached Files Attached Files

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

    Re: COUNTIFS is not calculating correctly

    Try this

    =COUNTIFS('Renewal Chart'!$L:$L,"",'Renewal Chart'!$B:$B,$B25&"*",'Renewal Chart'!$I:$I,"<=" &EOMONTH(J$17,0))

  3. #3
    Forum Contributor
    Join Date
    06-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: COUNTIFS is not calculating correctly

    This seems to have worked, but I still can't wrap my head around why I need it in this workbook but none of the others?

  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
    30,831

    Re: COUNTIFS is not calculating correctly

    It should not work in the other workbooks unless by chance (!!) all dates are EOMONTH dates.

  5. #5
    Forum Contributor
    Join Date
    06-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: COUNTIFS is not calculating correctly

    Not sure what you mean by that. I've attached another one of the workbooks that is working. Maybe you can help me understand the difference? I guess I need to decide if I need to go back through and change all the formulas in the other books and add the "<="

    Thanks!
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    06-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: COUNTIFS is not calculating correctly

    After inserting this and playing around I've discovered it actually isn't working for me. When I use that formula it is adding any blanks in column L regardless of the month. Well at least the month prior. So it is double counting any blanks in the previous month.

    I've reattached adding the "<=" & to both columns H and J and adding in a June expiration on the Renewal Chart Tab. You can see that it is double counting that blank cell once in column H and again in Column J. It should only show up in column H once I have this figured out.

    Again it works perfectly in every other workbook but I must be missing something on this one that is causing it to return different results.

    Thanks in advance for any help!
    Attached Files Attached Files
    Last edited by heresteve2; 06-02-2016 at 12:14 PM.

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: COUNTIFS is not calculating correctly

    Quote Originally Posted by heresteve2 View Post
    When I use that formula it is adding any blanks in column L regardless of the month. Well at least the month prior. So it is double counting any blanks in the previous month.
    That would be correct, the formula is only checking that the date in Renewal Chart!I:I is <=last day of the month of interest, not if the date specifically falls into that month.

    If you want to limit the results to those contained within the month then you need to add another range and criteria to the formula

    'Renewal Chart'!$I:$I,">" &EOMONTH(H$17,-1)

    This will check that the date in column I is after the last day of the preceding month, eliminating the erroneous results you describe.

    Similar applies to the column J formula, replacing H$17 with J$17.

    If it works perfectly in your other workbooks then that must be down to coincidence that there are no records where the criteria overlap. In reality, they should all be producing the same incorrect results.

    edit:-

    Dates in column I of the 'Essex' file are all month end dates, that's why your original formula works there. The July dates in the 'Urban' file are date the 20th, not 31st, so the date doesn't match up with the month end.
    Last edited by jason.b75; 06-02-2016 at 01:40 PM.

  8. #8
    Forum Contributor
    Join Date
    06-26-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: COUNTIFS is not calculating correctly

    YES! That is the difference I should have seen! Thank you.

    You edit then should work regardless of the day of the month that is in there correct?

    Thanks a million!

  9. #9
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: COUNTIFS is not calculating correctly

    When you spend too long looking at it, it becomes easy to miss things that you think should be obvious. If it's any consolation, I missed it the first time I went over it (and the second).

    If you add the extra parameter to the formula, i.e.

    =COUNTIFS('Renewal Chart'!$L:$L,"",'Renewal Chart'!$B:$B,$B25&"*",'Renewal Chart'!$I:$I,"<=" &EOMONTH(H$17,0),'Renewal Chart'!$I:$I,">" &EOMONTH(H$17,-1))

    Then that will count everything that falls into the month specified in H17, regardless of the day of month shown in column I.

    Or if you change the dates in column I so that they read as July 31 instead of July 20, then your original formula (Pre - John's edit) should work as it does with the other files.

    Personally I would go with the edited formula in all files as a failsafe for future discrepancies in the raw data.
    Last edited by jason.b75; 06-02-2016 at 02:04 PM.

+ 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. [SOLVED] COUNTIFS - am I using it correctly?
    By paulstan in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 10-18-2015, 12:31 PM
  2. Excel COUNTIFS not counting data correctly
    By Linda Borza in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 08-21-2013, 09:19 PM
  3. [SOLVED] Formula not calculating correctly
    By ratboyab in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-29-2013, 06:35 PM
  4. Excel not calculating correctly
    By atakpajr in forum Excel General
    Replies: 3
    Last Post: 11-08-2011, 03:32 PM
  5. Macro not calculating correctly
    By theebookzoo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-24-2011, 11:30 AM
  6. sumproduct not calculating correctly
    By icee in forum Excel General
    Replies: 8
    Last Post: 06-11-2009, 06:11 PM
  7. Date Not calculating correctly
    By vbehler in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-18-2007, 05:01 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