+ Reply to Thread
Results 1 to 11 of 11

Counting two criteria

  1. #1
    Registered User
    Join Date
    10-14-2007
    Posts
    12

    Counting two criteria

    Hi all i need help i have 2 columns in excel and i want to be able to do a count on. eg i want to find a A's in first column then with that information find out which rows have B in the second column

    Column 1 Column 2
    a s
    a f
    a b
    s d
    c l
    a b
    v v


    {=SUM(IF(Sheet2!B:B="A",IF(Sheet2!R:R="B",1,0)))}

    Total should be 3 but i need to get this to work on MS Excel 2000 or 2003. It works fine on 2007

  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
    I make it two

    Please Login or Register  to view this content.
    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
    10-14-2007
    Posts
    12
    Quote Originally Posted by VBA Noob
    I make it two

    Please Login or Register  to view this content.
    VBA Noob
    sorry typo

  4. #4
    Registered User
    Join Date
    10-14-2007
    Posts
    12
    Can it be done for a whole column as the data is from another source and it will change, [lis the information is from another sheet

    I take it, its some thing like below. Can you explain to me whats happening please as i dont understand the formula

    =SUMPRODUCT(--(Sheet2!B:B="a")*(Sheet2!R:R="b"))
    Last edited by dips_007; 10-14-2007 at 03:25 PM.

  5. #5
    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
    Not a whole column. Down to cell 65535 (last cell must be blank)

    =SUMPRODUCT(--(Sheet2!A1:A7="a")*(Sheet2!B1:B7="b"))
    VBA Noob

  6. #6
    Registered User
    Join Date
    10-14-2007
    Posts
    12
    Quote Originally Posted by VBA Noob
    Not a whole column. Down to cell 65535 (last cell must be blank)



    VBA Noob
    Can you explain to me whats happening please as i dont understand the formula

  7. #7
    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
    This parts checks that the range = a on sheet 2 ...change to your sheet

    Sheet2!A1:A7="a"
    and this part checks that the range = b on sheet 2 ...change to your sheet

    Sheet2!B1:B7="b"

    http://www.xldynamic.com/source/xld.SUMPRODUCT.html

    VBA Noob

  8. #8
    Registered User
    Join Date
    10-14-2007
    Posts
    12
    Quote Originally Posted by VBA Noob
    This parts checks that the range = a on sheet 2 ...change to your sheet



    and this part checks that the range = b on sheet 2 ...change to your sheet




    http://www.xldynamic.com/source/xld.SUMPRODUCT.html

    VBA Noob
    I mean the -- and the *

  9. #9
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Quote Originally Posted by dips_007
    Hi all i need help i have 2 columns in excel and i want to be able to do a count on. eg i want to find a A's in first column then with that information find out which rows have B in the second column

    Column 1 Column 2
    a s
    a f
    a b
    s d
    c l
    a b
    v v


    {=SUM(IF(Sheet2!B:B="A",IF(Sheet2!R:R="B",1,0)))}

    Total should be 3 but i need to get this to work on MS Excel 2000 or 2003. It works fine on 2007
    You can not use whole columns if you have older versions of Excel
    use B1:B65535 and R1:R65535 instead of B:B and R:R

  10. #10
    Registered User
    Join Date
    10-14-2007
    Posts
    12
    HI thanks for that guys how would i say
    1) NOT equal to b
    2)and also to ignore blanks
    Last edited by dips_007; 10-15-2007 at 03:28 PM.

  11. #11
    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
    <>b

    and

    Range <> ""

    VBA Noob

+ 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