+ Reply to Thread
Results 1 to 7 of 7

I tried but failed (Countif based questions)

Hybrid View

  1. #1
    Registered User
    Join Date
    05-31-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2003
    Posts
    5

    I tried but failed (Countif based questions)

    Hello people,

    I really hate to post anything here before trying. Both for self-satisfaction and to not clog unnecessarily.

    Well, I tried but couldn't get through this one so I was wondering if any one can help me.

    I have used this formula to count all records that are fall between 1st and 30th of April 2013 and are listed as "X351 Jaguar XJ" in column CC on "MYNM Jaguar" tab.

    =COUNTIFS('MYNM Jaguar'!H1:H38,">="&$B$3,'MYNM Jaguar'!H1:H38,"<="&$B$4,'MYNM Jaguar'!BR1:BR38,"="&Sheet1!$A$4)

    No records were coming back unfortunately though I know this should not be the case judging by the list.

    Can anyone help? File attached for reference
    Attached Files Attached Files

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: I tried but failed (Countif based questions)

    H1:H38 is the "factory order number" column.
    BR1:BR38 is the "export licence number" column.

    B7 =COUNTIFS('MYNM Jaguar'!$B$1:$B$38,">="&$B3,'MYNM Jaguar'!$B$1:$B$38,"<="&$B4,'MYNM Jaguar'!$CC$1:$CC$38,"="&Sheet1!$A$4)

    That do it for you?

    Note this is going to return zero even if it's correct with the test data set because you're checking for dates in 2013 when all your test dates are in 2012, it looks like. I got "29" when I expanded the test range to stretch from 2010 to 2013.

  3. #3
    Registered User
    Join Date
    05-31-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: I tried but failed (Countif based questions)

    HiBen,

    Thanks for your answer.

    I am looking for records that satisfy the following criteria:

    1. Date between 4/1/2013 and 4/30/2013 (in column S in "MYNM Jaguar" tab)
    2. = "X351 Jaguar XJ" (in column CC in "MYNM Jaguar" tab)

    @ben_hensel: the solution you provided did not really work out. And there are columns with April 2013 date in "MYNM Jaguar" tab - column S.

    Thanks again

  4. #4
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: I tried but failed (Countif based questions)

    So all you need to do is refer to S1:S38 rather than B1:B38 or H1:H38 then, right?

    Does that mean this is solved?

  5. #5
    Registered User
    Join Date
    05-31-2012
    Location
    Dubai
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: I tried but failed (Countif based questions)

    Quote Originally Posted by ben_hensel View Post
    So all you need to do is refer to S1:S38 rather than B1:B38 or H1:H38 then, right?

    Does that mean this is solved?

    Hello Ben,

    Yes, it works fine now.

    Once I ran this formulate for the larger data ranger, I came to the conclusion that I need to be substitute one of the criteria from Column CC to Column CG

    =COUNTIFS('MYNM Jaguar'!$S$1:$S$2000,">="&B$3,'MYNM Jaguar'!$S$1:$S$2000,"<="&B$4,'MYNM Jaguar'!$CC$1:$CC$2000,"="&Sheet1!$A$4)

    The trick is, I will need to extract the first 2 characters from the fields in Column CG. I tried LEFT (,) but that did not work. Can you give me this last push?

    Thanks

  6. #6
    Registered User
    Join Date
    11-10-2011
    Location
    JK Kohat
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: I tried but failed (Countif based questions)

    Dear, Try This.

    =COUNTIFS(MYNMJaguar!$B$2:$B$38,">="&Sheet1!B3,MYNMJaguar!$B$2:$B$38,"<="&Sheet1!B4,MYNMJaguar!$CC$2:$CC$38,Sheet1!$A$4)

  7. #7
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: I tried but failed (Countif based questions)

    COUNTIFS can't handle arrayed inputs, which is what's going to happen with your LEFT. So what you want is directly impossible, but there are still ways to handle it.

    There are two ways I would do this:

    1) Add a helper column, for example insert a new column next to CG that will be your new CH, and fill it with:
    CH2 = LEFT(CG2, 2)
    pull down

    And then use that column CH as the condition for the COUNTIF instead of column CG.



    2) Use an array-type formula instead of COUNTIFS.

    For now, I'm putting this additional text in:
    sheet1!A3 = "XJ"
    that I will be using as a comparitor instead of the full name in sheet1!A4.

    2.1) Using SUMPRODUCT()
    =SUMPRODUCT(--(LEFT('MYNM Jaguar'!$CG$2:$CG$2000,2)=$A$3), --('MYNM Jaguar'!$S$2:$S$2000>=B$3), --('MYNM Jaguar'!$S$2:$S$2000<=B$4))
    2.2) Using {SUM(IF(array))}
    {=SUM(IF(LEFT('MYNM Jaguar'!$CG$2:$CG$2000,2)=$A$3,1,0)*IF('MYNM Jaguar'!$S$2:$S$2000>=B$3,1,0)*IF('MYNM Jaguar'!$S$2:$S$2000<=B$4,1,0))}
    Note that, as a array formula, this has to be executed with CTRL+SHIFT+ENTER instead of just hitting ENTER.




    See attached for a demonstration of how these would work.
    Attached Files Attached Files

+ 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. Dependent Questions Based on Answers
    By oua in forum Excel General
    Replies: 2
    Last Post: 11-07-2013, 10:27 AM
  2. Problem based learning questions
    By fakersatlive in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-29-2013, 06:32 AM
  3. [SOLVED] Failed Lookup based on small function
    By MattRNR in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-20-2013, 09:03 PM
  4. Color coding certain rows based on answers to questions?
    By brittany182 in forum Excel General
    Replies: 1
    Last Post: 02-22-2013, 04:22 PM
  5. Countif accross multiple questions.
    By golden in forum Excel General
    Replies: 1
    Last Post: 10-28-2005, 01: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