+ Reply to Thread
Results 1 to 11 of 11

Counting the number of occurrences before the current week #

  1. #1
    Registered User
    Join Date
    07-01-2014
    Location
    Kansas, America
    MS-Off Ver
    2010
    Posts
    39

    Counting the number of occurrences before the current week #

    Hello,

    I have a spreadsheet for tracking jobs.
    Most everything is based off of week # rather than date.
    I am trying to get the stats page of the workbook to tally the total number of late jobs per week.
    The current week is taken care of because there is a function that automatically displays on time yes or no and I just set it to count the yeses or nos.
    The problem I am having is for past weeks.

    I tried- =COUNTIF(Table2[On-time],"No"+(CountIF(Table2[Week # Hidden],"<Weeknum(Now())" but that doesn't work. I also tried isolating the < like this. =COUNTIF(Table2[On-time],"No"+(CountIF(Table2[Week # Hidden],"<"Weeknum(Now()) and that did not work either.

    ------ UPDATE

    In response to using CountIFS I have also tried-
    =COUNTIFS(Table2[On-time],"NO",Table2[Due Week '# Hidden],"<Weeknum(Now())") this just returns a zero value even when I have a late job listed three weeks ago.

    Any help is appreciated, I know it has to be an easy solution but my brain just is not seeing it.

    Thanks!
    Last edited by jtmoore; 07-10-2014 at 01:35 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Counting the number of occurrences before the current week #

    If you have more than one condition, you should be using COUNTIFS, not COUNTIF.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-01-2014
    Location
    Kansas, America
    MS-Off Ver
    2010
    Posts
    39

    Re: Counting the number of occurrences before the current week #

    @ TMS

    In response to using CountIFS I have also tried-

    =COUNTIFS(Table2[On-time],"NO",Table2[Due Week '# Hidden],"<Weeknum(Now())") this just returns a zero value even when I have a late job listed three weeks ago.

    Any help is appreciated, I know it has to be an easy solution but my brain just is not seeing it.

    Thanks!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Counting the number of occurrences before the current week #

    Might be easier if you posted a sample workbook ...

  5. #5
    Registered User
    Join Date
    07-01-2014
    Location
    Kansas, America
    MS-Off Ver
    2010
    Posts
    39

    Re: Counting the number of occurrences before the current week #

    Oh...right.

    Okay, attached is the stats table. The row labeled "total late" is the one giving me problems.
    I have a test entry put into the log showing a late job from three weeks ago.

    I can get the 'current week' to read correctly simply by doing a count of the 'on-time' column on the attached stats log.
    However, I cannot get the past weeks to pick up the late entry. The 3 weeks column is blank because the last formula I tried would not even let me leave it in the cell.

    That was =COUNTIFS(Table2[On-time],"No",Table2[Due Week # Hidden],WEEKNUM(NOW())-3)
    I want the formula to return the # of times "No" shows up in the 'on-time' column of the stats log based on which week the
    job is due (Due Week # Hidden).

    I figured it would be easiest to try =Countifs(Table2[On-time],"No",Table2[Due Week # Hidden], <Weeknum(Now())) to get it to simply count how many "no"s are in the 'on-time' column for week #'s less than the current week #. That way, since a new week is added to the table each week, I am not always having to update with a new Weeknum(now())-1,-2, etc. But I have had no luck with that idea.

    Thanks,

    Stats Log.gif
    Stats Table.gif

  6. #6
    Registered User
    Join Date
    07-01-2014
    Location
    Kansas, America
    MS-Off Ver
    2010
    Posts
    39

    Re: Counting the number of occurrences before the current week #

    Any Ideas?

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,447

    Re: Counting the number of occurrences before the current week #

    They're pictures of worksheets, not a sample workbook.

  8. #8
    Registered User
    Join Date
    07-01-2014
    Location
    Kansas, America
    MS-Off Ver
    2010
    Posts
    39

    Re: Counting the number of occurrences before the current week #

    Here is the sample workbook.

    The blank cells in the Total Late row are the ones I am attempting to get the formula to fill.
    Attached Files Attached Files

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Counting the number of occurrences before the current week #

    I've not looked at your sample workbook, but your formula needs to be amended slightly, otherwise the WEEKNUM function is just taken as a string. Try this (changes shown in red):

    =COUNTIFS(Table2[On-time],"NO",Table2[Due Week '# Hidden],"<"&WEEKNUM(NOW()))

    Hope this helps.

    Pete

  10. #10
    Registered User
    Join Date
    07-01-2014
    Location
    Kansas, America
    MS-Off Ver
    2010
    Posts
    39

    Re: Counting the number of occurrences before the current week #

    That did it, thank you Pete_UK!

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Counting the number of occurrences before the current week #

    Glad to hear it - thanks for feeding back.

    Pete

+ 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] Counting number of occurrences in a given month
    By tief10 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-16-2014, 02:20 AM
  2. Counting for current week.
    By mattmorris in forum Excel General
    Replies: 1
    Last Post: 06-28-2012, 08:20 AM
  3. Counting text occurrences by week
    By KFitz in forum Excel - New Users/Basics
    Replies: 6
    Last Post: 09-29-2010, 06:06 PM
  4. Counting number occurrences
    By thermometer in forum Excel General
    Replies: 3
    Last Post: 06-06-2006, 03:10 PM
  5. Counting number of occurrences
    By LyleB_Austin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-15-2005, 06: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