+ Reply to Thread
Results 1 to 11 of 11

How to COUNT in this case

  1. #1
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Question How to COUNT in this case

    hi everyone,

    i have a database as following:

    Date Type
    1 a
    1 d
    1 a
    1 c
    2 a
    2 b
    3 c
    3 a
    3 d
    ..
    31

    Result Here
    Date Count
    1 ? (result is 3)
    2 ? (Result is 1)
    ..
    31

    I wanna count, how many a and d are there in Date 1 ???
    Last edited by vumian; 08-04-2006 at 10:55 AM.

  2. #2
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    Assuming your data is in Cells A1:B9 you can use this formula

    =SUMPRODUCT((A1:A9=1)*((B1:B9="a")+(B1:B9="d")))
    ---------------------------------------------------
    ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
    To insert code into the VBE (Visual Basic Editor)
    1. Copy the code.
    2. Open workbook to paste code into.
    3. Right click any worksheet tab, select View Code
    4. VBE (Visual Basic Editor) opens to that sheets object
    5. You may change to another sheets object or the This Workbook object by double clicking it in the Project window
    6. In the blank space below the word "General" paste the copied code.

  3. #3
    Mark
    Guest

    Re: How to COUNT in this case


    I dont know of a way to do this with a built in Excel Function. If you
    want I could build you a custom one. I would just need you to answer a
    few questions so I could do Exactly what you wanted. Lemme know...


  4. #4
    Jim Thomlinson
    Guest

    RE: How to COUNT in this case

    =SUMPRODUCT((D1=$A$2:$A$100)*(($B$2:$B$100="a")+($B$2:$B$100="d")))

    Where The number 1 is in D1, 2 is in D2, ... and your database is in A2:B100
    --
    HTH...

    Jim Thomlinson


    "vumian" wrote:

    >
    > hi everyone,
    >
    > i have a database as following:
    >
    > Date Type
    > 1 a
    > 1 d
    > 1 a
    > 2 a
    > 2 b
    > 3 c
    > 3 a
    > 3 d
    > ..
    > 31
    >
    > Result Here
    > Date Count
    > 1 ? (result is 3)
    > 2 ? (Result is 1)
    > ..
    > 31
    >
    > I wanna count, how many a and d are there in Date 1 ???
    >
    >
    > --
    > vumian
    > ------------------------------------------------------------------------
    > vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
    > View this thread: http://www.excelforum.com/showthread...hreadid=568344
    >
    >


  5. #5
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Thumbs up

    hi man,

    it's so good man, thank you very much

    i wanna understand more about fx SUMPRODUCT, where can i find it ?

  6. #6
    Jim Thomlinson
    Guest

    Re: How to COUNT in this case

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

    Jim Thomlinson


    "vumian" wrote:

    >
    > hi man,
    >
    > it's so good man, thank you very much
    >
    > i wanna understand more about fx SUMPRODUCT, where can i find it ?
    >
    >
    > --
    > vumian
    > ------------------------------------------------------------------------
    > vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
    > View this thread: http://www.excelforum.com/showthread...hreadid=568344
    >
    >


  7. #7
    Jim Thomlinson
    Guest

    Re: How to COUNT in this case

    So all of the items that are not a and not d

    =SUMPRODUCT((D1=$A$2:$A$100)*($B$2:$B$100<>"a")*($B$2:$B$100<>"d"))

    --
    HTH...

    Jim Thomlinson


    "vumian" wrote:

    >
    > hi Jim Thomlinson,
    >
    > everyone here is nice ,
    > oke, there is a small thing,
    > how about i can count the rest thing, same example above ?
    >
    > result
    >
    > 1 ? (result is 1)
    > 2 ? (1 too)
    >
    > i do not wanna use fx + many times, coz it makes fomula long
    >
    > thank you for help one more.
    >
    >
    > --
    > vumian
    > ------------------------------------------------------------------------
    > vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
    > View this thread: http://www.excelforum.com/showthread...hreadid=568344
    >
    >


  8. #8
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Thumbs up

    hi man,
    x-tremely great

    i aslo other way, i use countif(range,criteria)-result above

    anyway, your way pro more.
    thank a lots

  9. #9
    Jim Jackson
    Guest

    RE: How to COUNT in this case

    If you just want to use formulae in the Results cells, this will work. Be
    sure to press "ctrl/alt/Enter" since this is an array formula.

    =IF(B2:B9 = "a",COUNTIF(A2:A9,"1"),0)

    Just change the letters and numbers for each respective cell.
    --
    Best wishes,

    Jim


    "vumian" wrote:

    >
    > hi everyone,
    >
    > i have a database as following:
    >
    > Date Type
    > 1 a
    > 1 d
    > 1 a
    > 2 a
    > 2 b
    > 3 c
    > 3 a
    > 3 d
    > ..
    > 31
    >
    > Result Here
    > Date Count
    > 1 ? (result is 3)
    > 2 ? (Result is 1)
    > ..
    > 31
    >
    > I wanna count, how many a and d are there in Date 1 ???
    >
    >
    > --
    > vumian
    > ------------------------------------------------------------------------
    > vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
    > View this thread: http://www.excelforum.com/showthread...hreadid=568344
    >
    >


  10. #10
    Forum Contributor
    Join Date
    07-18-2006
    Posts
    135

    Question

    hi Jim Jackson,

    thanks for your code
    but it do not work for me, i do not know why ?

    and i Press Ctrl Alt Enter, Nothing happened man, why ?

    and what mean once pressing Ctrl Alt Enter ?

    thanks in advance for your explanation

  11. #11
    Jim Jackson
    Guest

    Re: How to COUNT in this case

    I should have said that the "Ctrl" and "Alt" buttons need to be down before
    pressing "Enter." This may be why it is not working. Also, be sure the
    correct cells are referenced in your formula.
    --
    Best wishes,

    Jim


    "vumian" wrote:

    >
    > hi Jim Jackson,
    >
    > thanks for your code
    > but it do not work for me, i do not know why ?
    >
    > and i Press Ctrl Alt Enter, Nothing happened man, why ?
    >
    > and what mean once pressing Ctrl Alt Enter ?
    >
    > thanks in advance for your explanation
    >
    >
    > --
    > vumian
    > ------------------------------------------------------------------------
    > vumian's Profile: http://www.excelforum.com/member.php...o&userid=36494
    > View this thread: http://www.excelforum.com/showthread...hreadid=568344
    >
    >


+ 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