+ Reply to Thread
Results 1 to 5 of 5

Lookup / count ?

  1. #1
    Registered User
    Join Date
    04-12-2007
    Posts
    5

    Lookup / count ?

    Hi all

    I am having problems with implementing a function in my excel sheet. Pls see the example / table:


    Sweden..............yes
    Denmark .............no
    Uk .....................yes
    Italy ..................yes
    Spain .................no
    Belgium ..............yes
    Sweden .............yes
    Denmark .............no
    Uk .....................no
    Italy ..................yes
    Spain .................no
    Belgium ...............no

    and so forth... (countries always in the same order and new lines constantly being added to the document)

    What I want to be able to do is to count all the yes's for the different countries. I.e. in this case: Sweden 2, Denmark 0, UK 1 etc...

    I have tried this with lookup and countif but cannot get it to work.

    I highly appreciate any help.
    Thanks in advance
    Palina

  2. #2
    Forum Expert
    Join Date
    01-12-2007
    Location
    New Jersey
    Posts
    2,127
    You have more than one variable, so countif will not work.

    Try this:

    =SUMPRODUCT(--(A1:A100="DENMARK"),(--B1:B100="YES"))

    Obviously, adjust your range to suit.

  3. #3
    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
    Prehaps

    =SUMPRODUCT(--($A$1:$A$12="Sweden")*($B$1:$B$12="yes"))

    or if Sweden is in say cell C1

    =SUMPRODUCT(--($A$1:$A$12=C1)*($B$1:$B$12="yes"))

    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 !!!

  4. #4
    Registered User
    Join Date
    04-12-2007
    Posts
    5

    thank you

    it works!

    Thank you so much
    reg
    palina

  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
    Glad you got a solution

    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