+ Reply to Thread
Results 1 to 2 of 2

And/Countif formula

  1. #1
    nir020
    Guest

    And/Countif formula

    I have a range of data which looks like something like this:-

    london -2
    london -2
    london -1
    wales -2

    I am trying to create a formula that counts the number of times the first
    column contains -1 and the second column contains -2, so far I have come up
    with the formula:-

    =SUM(IF(AND($B$4:$B$11="london",$C$4:$C$11=-2),1,0))

    But this only returns a value of 1, can you help?





  2. #2
    Roger Govier
    Guest

    Re: And/Countif formula

    Hi

    This needs to be entered as an array formula so commit with
    Ctrl+Shift+Enter.
    Excel will include the curly braces { } when you do this. Do not type
    them yourself.
    {=SUM(IF(AND($B$4:$B$11="london",$C$4:$C$11=-2),1,0))}

    for a non-array solution you could use
    =SUMPRODUCT(--($B$4:$B$11="london"),--($C$4:$C$11=-2))


    --
    Regards

    Roger Govier


    "nir020" <nir020@discussions.microsoft.com> wrote in message
    news:3A3F717E-FD4A-434B-AF05-D3D889C49D36@microsoft.com...
    >I have a range of data which looks like something like this:-
    >
    > london -2
    > london -2
    > london -1
    > wales -2
    >
    > I am trying to create a formula that counts the number of times the
    > first
    > column contains -1 and the second column contains -2, so far I have
    > come up
    > with the formula:-
    >
    > =SUM(IF(AND($B$4:$B$11="london",$C$4:$C$11=-2),1,0))
    >
    > But this only returns a value of 1, can you 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