+ Reply to Thread
Results 1 to 7 of 7

Nested IF,COUNTA, and COUNTIF problem

  1. #1
    Registered User
    Join Date
    12-23-2006
    Posts
    6

    Nested IF,COUNTA, and COUNTIF problem

    What I need to do is to COUNTA and COUNTIF on specific columns only on rows where a different column contains specific information, I'll try a visual below...


    A B C
    1 0 1
    1 1 1
    1 0 0
    1 1 1
    2 1 0
    2 1 0

    I need the function to check column a, if a=2, then I want it to countif columns b and c separately (functions will be separate for each column).

    Here's a sample of what I'm trying to use:

    Please Login or Register  to view this content.
    But it's giving me an error with the "I141E" section. This is an ID I'm checking to try and separate data without doing it manually.

    *UPDATE*
    I realized I can do the COUNTA function I need by simply utilizing the original "A" column, but I'm still stumped on how to COUNTIF on columns "b" and "c" only on row which contain specific data "2" in column "A"...
    Last edited by Zcwilkins; 12-03-2007 at 02:36 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Instead of giving us your formula could you post what the expected result is.


    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    12-23-2006
    Posts
    6
    Sorry, but I don't really understand what you're asking, but I'll try...

    I'm just expecting a counted number of rows in a column where a different column is checked for an id number...

    Reworded to above example dataset, I want the function to count column c if it equals 1 and if column a=1..."and" I think is the appropriate word. I didn't try nesting the AND function in the COUNTIF function. I'll try that next...

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Still not sure what your after but see if this helps

    =SUMPRODUCT(--(A1:A6=1)*(B1:B6=1)*(C1:C6=1))
    If Col A and Col B and Col C all equal 1 then it counts once. See for your example it will return 2.

    VBA Noob

  5. #5
    Registered User
    Join Date
    12-23-2006
    Posts
    6
    I don't think that will work with what I'm trying to do and I couldn't get it right with the AND function either, of course I'm probably doing it wrong.

    Please Login or Register  to view this content.
    What I want it to do is count column B only if column A=I141H and column b=5. In this case the result would be 1...

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    =SUMPRODUCT(--(A1:A9="I141H")*(B1:B9=5))
    VBA Noob

  7. #7
    Registered User
    Join Date
    12-23-2006
    Posts
    6
    That seems to work perfect. What I didn't realize at first was the dataset I was running these functions off had all the numbers stored as text causing the function to error out.

    Thanks a ton for your help!

+ 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