+ Reply to Thread
Results 1 to 4 of 4

Logical And'ing over a range

  1. #1
    Registered User
    Join Date
    06-28-2007
    Posts
    4

    Logical And'ing over a range

    I'm being fustrated by something that should be fair easy :/

    In a spread sheet i've 3 columns 2 of text 1 of numbers. eg;

    A B C
    m op 10
    t op 12
    m op 22
    m mac 33

    what i'm after doing is adding up the qty in C when theres both m and op in a row.

    If it was just 1 column it'd be a simple =sumif(a:a,"m",c:c), with using 'AND' i can compare idividual rows, but i can't seem to get it to add up over the entire range.

  2. #2
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    Hi,

    You need to use sumproduct

    =SUMPRODUCT(--(A1:A10="m")*(b1:b10="op"),(c1:c10)

    Note, adjust your ranges to suit - all ranges must be the same length

    ED

  3. #3
    Registered User
    Join Date
    06-28-2007
    Posts
    4
    Thanks that works great. Although what's the significance of the --?

    i tested removing it from my forumula and it seemed to have no affect.
    Last edited by ExcellantA; 06-28-2007 at 09:22 AM.

  4. #4
    Forum Contributor EdMac's Avatar
    Join Date
    01-23-2006
    Location
    Exeter, UK
    MS-Off Ver
    2003
    Posts
    1,264
    Glad to hear it works

    -- is what is called a double unary operator - you need it if you are looking at text value.

    SUMPRODUCT is described in some useful detail at

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

    Its worth a read.

    Ed

+ 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