+ Reply to Thread
Results 1 to 16 of 16

SUMIF using two columns in both Range and Criteria

  1. #1
    Bob Phillips
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)

    --
    HTH

    Bob Phillips

    "Gordon" <[email protected]> wrote in message
    news:[email protected]...
    > I have a speadsheet with columns as under:
    >
    > Account Code Department Amount
    > ------------ ---------- ------
    > 7000 12 £100
    > 7050 5 £250
    >
    > There are a couple of hundred rows with different account numbers and a
    > variety of Department numbers.
    >
    > Is there a way I can use SUMIF to summarize the amounts by Code AND
    > Department? In other words I want to sum ALL the amounts with Code 7000
    > and Dept 12 etc.
    >
    > Thanks!




  2. #2
    Gordon
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    Bob Phillips wrote:
    > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    >


    I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!

  3. #3
    Bob Phillips
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    As an aside, this version

    =SUMPRODUCT(--(A1:A20=7000),--(B1:B20=12),C1:C20)

    although longer is more efficient I am sure


    --
    HTH

    Bob Phillips

    "Gordon" <[email protected]> wrote in message
    news:[email protected]...
    > Bob Phillips wrote:
    > > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    > >

    >
    > I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!




  4. #4
    Dave Peterson
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    And might be safer, too.

    If the OP had something like this,

    Account Dept
    7000 12
    70001 2
    7 00012

    the original formula might yield incorrect results.

    Bob Phillips wrote:
    >
    > As an aside, this version
    >
    > =SUMPRODUCT(--(A1:A20=7000),--(B1:B20=12),C1:C20)
    >
    > although longer is more efficient I am sure
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "Gordon" <[email protected]> wrote in message
    > news:[email protected]...
    > > Bob Phillips wrote:
    > > > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    > > >

    > >
    > > I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!


    --

    Dave Peterson

  5. #5
    Aladin Akyurek
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    You can stay with SumIf if you create an additional column...

    Let A1:C3 house the sample you provided.

    D1: Concat

    D2, copied down:

    =A2&"#"&B2

    Now invoke...

    =SUMIF($D$2:$D$3,$F2&"#"&G$1,$C$2:$C$3)

    where F2 houses an account number and G1 a department.

    If you are on Excel 2003, convert A1:D3 into a list using
    Data|List|Create List.

    Gordon wrote:
    > I have a speadsheet with columns as under:
    >
    > Account Code Department Amount
    > ------------ ---------- ------
    > 7000 12 £100
    > 7050 5 £250
    >
    > There are a couple of hundred rows with different account numbers and a
    > variety of Department numbers.
    >
    > Is there a way I can use SUMIF to summarize the amounts by Code AND
    > Department? In other words I want to sum ALL the amounts with Code 7000
    > and Dept 12 etc.
    >
    > Thanks!


  6. #6
    Bob Phillips
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)

    --
    HTH

    Bob Phillips

    "Gordon" <[email protected]> wrote in message
    news:[email protected]...
    > I have a speadsheet with columns as under:
    >
    > Account Code Department Amount
    > ------------ ---------- ------
    > 7000 12 £100
    > 7050 5 £250
    >
    > There are a couple of hundred rows with different account numbers and a
    > variety of Department numbers.
    >
    > Is there a way I can use SUMIF to summarize the amounts by Code AND
    > Department? In other words I want to sum ALL the amounts with Code 7000
    > and Dept 12 etc.
    >
    > Thanks!




  7. #7
    Gordon
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    Bob Phillips wrote:
    > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    >


    I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!

  8. #8
    Bob Phillips
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    As an aside, this version

    =SUMPRODUCT(--(A1:A20=7000),--(B1:B20=12),C1:C20)

    although longer is more efficient I am sure


    --
    HTH

    Bob Phillips

    "Gordon" <[email protected]> wrote in message
    news:[email protected]...
    > Bob Phillips wrote:
    > > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    > >

    >
    > I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!




  9. #9
    Dave Peterson
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    And might be safer, too.

    If the OP had something like this,

    Account Dept
    7000 12
    70001 2
    7 00012

    the original formula might yield incorrect results.

    Bob Phillips wrote:
    >
    > As an aside, this version
    >
    > =SUMPRODUCT(--(A1:A20=7000),--(B1:B20=12),C1:C20)
    >
    > although longer is more efficient I am sure
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "Gordon" <[email protected]> wrote in message
    > news:[email protected]...
    > > Bob Phillips wrote:
    > > > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    > > >

    > >
    > > I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!


    --

    Dave Peterson

  10. #10
    Aladin Akyurek
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    You can stay with SumIf if you create an additional column...

    Let A1:C3 house the sample you provided.

    D1: Concat

    D2, copied down:

    =A2&"#"&B2

    Now invoke...

    =SUMIF($D$2:$D$3,$F2&"#"&G$1,$C$2:$C$3)

    where F2 houses an account number and G1 a department.

    If you are on Excel 2003, convert A1:D3 into a list using
    Data|List|Create List.

    Gordon wrote:
    > I have a speadsheet with columns as under:
    >
    > Account Code Department Amount
    > ------------ ---------- ------
    > 7000 12 £100
    > 7050 5 £250
    >
    > There are a couple of hundred rows with different account numbers and a
    > variety of Department numbers.
    >
    > Is there a way I can use SUMIF to summarize the amounts by Code AND
    > Department? In other words I want to sum ALL the amounts with Code 7000
    > and Dept 12 etc.
    >
    > Thanks!


  11. #11
    Gordon
    Guest

    SUMIF using two columns in both Range and Criteria

    I have a speadsheet with columns as under:

    Account Code Department Amount
    ------------ ---------- ------
    7000 12 £100
    7050 5 £250

    There are a couple of hundred rows with different account numbers and a
    variety of Department numbers.

    Is there a way I can use SUMIF to summarize the amounts by Code AND
    Department? In other words I want to sum ALL the amounts with Code 7000
    and Dept 12 etc.

    Thanks!

  12. #12
    Bob Phillips
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)

    --
    HTH

    Bob Phillips

    "Gordon" <[email protected]> wrote in message
    news:[email protected]...
    > I have a speadsheet with columns as under:
    >
    > Account Code Department Amount
    > ------------ ---------- ------
    > 7000 12 £100
    > 7050 5 £250
    >
    > There are a couple of hundred rows with different account numbers and a
    > variety of Department numbers.
    >
    > Is there a way I can use SUMIF to summarize the amounts by Code AND
    > Department? In other words I want to sum ALL the amounts with Code 7000
    > and Dept 12 etc.
    >
    > Thanks!




  13. #13
    Gordon
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    Bob Phillips wrote:
    > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    >


    I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!

  14. #14
    Bob Phillips
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    As an aside, this version

    =SUMPRODUCT(--(A1:A20=7000),--(B1:B20=12),C1:C20)

    although longer is more efficient I am sure


    --
    HTH

    Bob Phillips

    "Gordon" <[email protected]> wrote in message
    news:[email protected]...
    > Bob Phillips wrote:
    > > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    > >

    >
    > I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!




  15. #15
    Dave Peterson
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    And might be safer, too.

    If the OP had something like this,

    Account Dept
    7000 12
    70001 2
    7 00012

    the original formula might yield incorrect results.

    Bob Phillips wrote:
    >
    > As an aside, this version
    >
    > =SUMPRODUCT(--(A1:A20=7000),--(B1:B20=12),C1:C20)
    >
    > although longer is more efficient I am sure
    >
    > --
    > HTH
    >
    > Bob Phillips
    >
    > "Gordon" <[email protected]> wrote in message
    > news:[email protected]...
    > > Bob Phillips wrote:
    > > > =SUMPRODUCT(--(A1:A20&B1:B20="700012"),C1:C20)
    > > >

    > >
    > > I'd just found "sumproduct" but your version of it is MUCH neater. Thanks!


    --

    Dave Peterson

  16. #16
    Aladin Akyurek
    Guest

    Re: SUMIF using two columns in both Range and Criteria

    You can stay with SumIf if you create an additional column...

    Let A1:C3 house the sample you provided.

    D1: Concat

    D2, copied down:

    =A2&"#"&B2

    Now invoke...

    =SUMIF($D$2:$D$3,$F2&"#"&G$1,$C$2:$C$3)

    where F2 houses an account number and G1 a department.

    If you are on Excel 2003, convert A1:D3 into a list using
    Data|List|Create List.

    Gordon wrote:
    > I have a speadsheet with columns as under:
    >
    > Account Code Department Amount
    > ------------ ---------- ------
    > 7000 12 £100
    > 7050 5 £250
    >
    > There are a couple of hundred rows with different account numbers and a
    > variety of Department numbers.
    >
    > Is there a way I can use SUMIF to summarize the amounts by Code AND
    > Department? In other words I want to sum ALL the amounts with Code 7000
    > and Dept 12 etc.
    >
    > Thanks!


+ 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