+ Reply to Thread
Results 1 to 6 of 6

Thread: Countifs and Dates

  1. #1
    Registered User
    Join Date
    09-02-2011
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    3

    Countifs and Dates

    Hey everyone,

    Here's my problem: I need to use COUNTIFS to count if pieces of equipment have had maintainence done after a specific date, and what class it is (T1/T2/T3).

    Constraints: I want the date to be entered in a cell by the user.

    Here's the formula I'm attempting to use, but it keeps coming up as zero. If I break the formula into two COUNTIF statements (splitting each statement into it's own cell), I positive numbers (which is ideal). When combining, I get zero...


    Main Formula (results in zero):
    =COUNTIFS('Transformer Oil'!H:H,">="&Calculations!O32,'Transformer Oil'!D:D,"T1")

    Two Seperate Formulas (results in positive whole numbers [Good!])
    =COUNTIF('Transformer Oil'!H:H,">="&Calculations!O32)

    =COUNTIF('Transformer Oil'!D:D,"T1")


    Does combining COUNTIF statements into a single COUNTIFS, when there is date formatting, automatically make it zero? I can't figure this one out... Thanks in advance!

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

    Re: Countifs and Dates

    Are you sure the dates >= Calculations!O32 are lining up with the "T1" in same rows? If they are, then it should work as you have shown.
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

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

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

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    6,204

    Re: Countifs and Dates

    Countifs look BOTH criteria at the same time...

    Count how many 5's in each column in case:
    5	2
    3	5
    Will result 2.

    COUNTIFS will result 0 (there are no 5's in both column at the same time).
    "Relax. What is mind? No matter. What is matter? Never mind!"

  4. #4
    Registered User
    Join Date
    09-02-2011
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Countifs and Dates

    NBVC and zbor, you guys nailed it. You guys were right. I had thought they were in the exact same rows, but they are offset by one. I was confused because the T1 column is merged every two vertical cells, but they start 1 row higher than the dates.

    Here's an example, assume T1 is merged for 2 rows at a time. (X refers to another description).

    T1.........X
    .............Date
    T1.........X
    .............Date


    So, here poses another question. What function would be able to check if that piece of equipment is T1, and maintenance occurred after specified date, assuming they are offset by each row? Thanks in advance!

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    6,204

    Re: Countifs and Dates

    Move range for one row...
    But you can't use whole column for that.

    So, for instance, instead of:

    =COUNTIFS('Transformer Oil'!$H$1:$H$1000,">="&Calculations!O32,'Transformer Oil'!$D$1:$D$1000,"T1")

    use

    =COUNTIFS('Transformer Oil'!$H$1:$H$1000,">="&Calculations!O32,'Transformer Oil'!$D$2:$D$1001,"T1")
    "Relax. What is mind? No matter. What is matter? Never mind!"

  6. #6
    Registered User
    Join Date
    09-02-2011
    Location
    Illinois
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Countifs and Dates

    Zbor, thanks again. I definitly appreciate your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0