Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Gordon
 
Posts: n/a
Default 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!
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

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

--
HTH

Bob Phillips

"Gordon" wrote in message
...
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!



  #3   Report Post  
Gordon
 
Posts: n/a
Default

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   Report Post  
Bob Phillips
 
Posts: n/a
Default

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" wrote in message
...
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!



  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

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" wrote in message
...
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


  #6   Report Post  
Aladin Akyurek
 
Posts: n/a
Default

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUMIF using two columns in both Range and Criteria Gordon Excel Discussion (Misc queries) 5 June 29th 05 06:56 PM
Sumif function with two criteria from different columns SamFortMyers Excel Worksheet Functions 4 April 25th 05 12:48 AM
SUMIF with only one criteria cell within range Stan Excel Discussion (Misc queries) 5 December 16th 04 10:12 PM
can I use a range of dates as a criteria when using sumif? D@annyBoy Excel Worksheet Functions 5 December 2nd 04 01:37 PM
SUMIF multiple criteria in 1 range Mike@Q Excel Worksheet Functions 5 November 26th 04 03:55 PM


All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"