+ Reply to Thread
Results 1 to 6 of 6

COUNTIF On Two Columns

  1. #1
    Valued Forum Contributor
    Join Date
    09-23-2005
    Location
    Bristol, UK
    MS-Off Ver
    2007
    Posts
    664

    COUNTIF On Two Columns

    Hi all,

    I'm trying to create a formula that counts in two columns. Basically I have one column that has either 'Type 1' or 'Type 2' listed in it, then another that users enter dates into if/when they complete a task.

    What I'm trying to do is get Excel to count at the same time a) if a column (G2:G800) has a date entered, and if so count it if it's 'Type 1'. I've fiddled around with a number of formula ideas but seem to be having no luck.

    Can anyone suggest a solution?

    TIA,

    SamuelT

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    =SUMPRODUCT((A2:A8000="Type 1")+0,(G2:G8000<>"")+0)

    adjust ranges to suit. Assumes you won't have anything other than dates in the second column.

  3. #3
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517

    Changing Logical to Numeric

    I wondered what the +0 was for in your formula, so I tried it out.

    What a nice trick for changing TRUE to 1 and FALSE to 0.


    Mark.

  4. #4
    Valued Forum Contributor
    Join Date
    09-23-2005
    Location
    Bristol, UK
    MS-Off Ver
    2007
    Posts
    664
    Hi again,

    Thanks for that. Got a slight oddity that hopefully someone might be able to suggest. So Richard's suggestion works great, however when I change the formula to:

    =SUMPRODUCT((C10:C1000="Type 2")+0,(F10:F1002<>"")+0)

    I get a #VALUE! returned. And also when I change it to:

    =SUMPRODUCT((C2:C1001="Type 1")+0,(G10:G1001="Y")+0)

    I get a #N/A return.

    Any suggestions why this might be the case?

    TIA,

    SamuelT

  5. #5
    Valued Forum Contributor
    Join Date
    09-23-2005
    Location
    Bristol, UK
    MS-Off Ver
    2007
    Posts
    664
    First problem solved, the two ranges weren't equal...

  6. #6
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    Hi Samuel

    =SUMPRODUCT((C2:C1001="Type 1")+0,(G10:G1001="Y")+0)

    The two ranges here aren't equal either. I suspect the #NA results from there being this error value in one of your ranges though.

+ 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