+ Reply to Thread
Results 1 to 14 of 14

Nested Countif

  1. #1
    Registered User
    Join Date
    02-01-2007
    Posts
    7

    Nested Countif

    I am having a real problem and have looked everywhere? I have a speadsheet 7 colums and 50 rows, in colum B it has either a W or L in it and in colum G it either has C or F in it In a nother cell I need to display as a number if a row contains a W in colum B and a C in colum G?

    Can anyone please help with this???

    Thanks

  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
    Try

    =SUMPRODUCT(--(B1:B200="W"),--(G1:G200="C"))

    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
    02-01-2007
    Posts
    7
    when I paste this into excel it just displays

    =SUMPRODUCT(--(B1:B200="W"),--(G1:G200="C")) in the cell

    not the result, am I doing something wrong?

  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
    Hi,

    1). Make sure there is no leading space before the equals sign
    2). Make sure the cell is formatted as general not text

    VBA Noob

  5. #5
    Registered User
    Join Date
    02-01-2007
    Posts
    7
    THANK YOU, its working great! I put a space before the formula

    Thank you

  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
    No problem

    Glad it helped

    VBA Noob

  7. #7
    Registered User
    Join Date
    02-01-2007
    Posts
    7
    Works great on my computer but when I put it in my pda it does not seem to work? is the another way this can be done? that my work on my pda

  8. #8
    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
    Hopefully you can use an array CSE.

    Enter with Ctrl + Shift + Enter

    =SUM((B1:B50="w")*(G1:G50="C")*1)

    VBA Noob

  9. #9
    Registered User
    Join Date
    02-01-2007
    Posts
    7
    i am not sure how to enter that way on pocket excel
    Last edited by tuck80; 02-01-2007 at 07:11 PM.

  10. #10
    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
    Can think of a way at the moment

    Could you refer to the sumproduct formula

    E.g Say Sumproduct in H1 then in J1 enter = H1

    For your ref these are the functions you can use for a PDA

    http://www.ehansberry.com/pages/Pock...lFunctions.htm

    VBA Noob

  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
    Or

    use a helper column. So enter this a column after your data e.g Col 8 (I)

    =IF(AND(B1="W",G1="C"),1,0)

    and drag down. Then sum the 1's

    VBA Noob

  12. #12
    Registered User
    Join Date
    02-01-2007
    Posts
    7
    So put this in the 8th colum =IF(AND(B1="W",G1="C"),1,0)

    What do I put in the cell were I want to display the result of number of rows with a W and a C?

  13. #13
    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
    It's a helper column.

    When you drag the formula down it will show 1's and O's

    The 1's are rows which have a W in Col B and C in Col G.

    Then use a simple sum formula to sum the nuber 1's in I in say J1 e.g = Sum(I:I) and you can then hide Column I

    VBA Noob

  14. #14
    Registered User
    Join Date
    02-01-2007
    Posts
    7
    just waiting for my pda to get some charge and I will try it and post my results

+ 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