#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default sumif with 'OR'

I would like to add up columns that meet 1 criteria from column 1 and that
also meet certain criteria from column B.

A B C
212 31A 20
304 31A 20
212 31B 20
212 31C 10
304 31B 20

For e.g. is there some way I can add up all the Amounts for 212 (from Column
A) that are either 31A or 31B (from column B) returning back an answer that
sums the relevant figures from column C?

If you have an answer, it will be much appreciated; I've beens scratching my
head with this one for a while!

Thanks,
Amanda

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default sumif with 'OR'

One way:

=SUMPRODUCT(--(A1:A10=212),--(((B1:B10="31a")+(B1:B10="31b"))0),C1:C10)

Adjust the ranges to match--but you can't use whole columns (except in xl2007).

=sumproduct() likes to work with numbers. The -- stuff changes trues and falses
to 1's and 0's.

Bob Phillips explains =sumproduct() in much more detail he
http://www.xldynamic.com/source/xld.SUMPRODUCT.html

And J.E. McGimpsey has some notes at:
http://mcgimpsey.com/excel/formulae/doubleneg.html



A Heeps wrote:

I would like to add up columns that meet 1 criteria from column 1 and that
also meet certain criteria from column B.

A B C
212 31A 20
304 31A 20
212 31B 20
212 31C 10
304 31B 20

For e.g. is there some way I can add up all the Amounts for 212 (from Column
A) that are either 31A or 31B (from column B) returning back an answer that
sums the relevant figures from column C?

If you have an answer, it will be much appreciated; I've beens scratching my
head with this one for a while!

Thanks,
Amanda


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 698
Default sumif with 'OR'

Try something like this:

Using your posted data list...
F2: 212
G2: 31A
G3: 31B

This formula returns the sum of Col_C items where the corresponding Col_A
value equals 212 AND the corresponding Col_B value equals 31A OR 31B
H2: =SUMPRODUCT((A2:A10=F2)*((B2:B10=G2)+(B2:B10=G3))* C2:C10)

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"A Heeps" wrote:

I would like to add up columns that meet 1 criteria from column 1 and that
also meet certain criteria from column B.

A B C
212 31A 20
304 31A 20
212 31B 20
212 31C 10
304 31B 20

For e.g. is there some way I can add up all the Amounts for 212 (from Column
A) that are either 31A or 31B (from column B) returning back an answer that
sums the relevant figures from column C?

If you have an answer, it will be much appreciated; I've beens scratching my
head with this one for a while!

Thanks,
Amanda

  #4   Report Post  
Posted to microsoft.public.excel.misc
bj bj is offline
external usenet poster
 
Posts: 1,397
Default sumif with 'OR'

sumproduct() will work
= sumproduct(--(A1:A1000=212),--(or(B1:B1000="31A",B1:B1000="31B)),C1:C1000)
the "--(" changes the logical true false to a numeric 1 0
you cannot reference an entire column in Sumproduct (A:A wont work)
all of the arrays have to be the same size

"A Heeps" wrote:

I would like to add up columns that meet 1 criteria from column 1 and that
also meet certain criteria from column B.

A B C
212 31A 20
304 31A 20
212 31B 20
212 31C 10
304 31B 20

For e.g. is there some way I can add up all the Amounts for 212 (from Column
A) that are either 31A or 31B (from column B) returning back an answer that
sums the relevant figures from column C?

If you have an answer, it will be much appreciated; I've beens scratching my
head with this one for a while!

Thanks,
Amanda

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,718
Default sumif with 'OR'

=SUMPRODUCT((A1:A5=212)*(B1:B5={"31A","31B"})*C1:C 5)


"A Heeps" wrote:

I would like to add up columns that meet 1 criteria from column 1 and that
also meet certain criteria from column B.

A B C
212 31A 20
304 31A 20
212 31B 20
212 31C 10
304 31B 20

For e.g. is there some way I can add up all the Amounts for 212 (from Column
A) that are either 31A or 31B (from column B) returning back an answer that
sums the relevant figures from column C?

If you have an answer, it will be much appreciated; I've beens scratching my
head with this one for a while!

Thanks,
Amanda

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 Phil Excel Worksheet Functions 3 March 21st 06 02:17 AM
Sumif using or [email protected] Excel Worksheet Functions 3 March 17th 06 02:27 AM
Embedding a Sumif in a sumif C.Pflugrath Excel Worksheet Functions 5 August 31st 05 07:31 PM
nested sumif or sumif with two criteria dshigley Excel Worksheet Functions 5 April 5th 05 03:34 AM
SUMIF - Range name to used for the "sum_range" portion of a SUMIF function Oscar Excel Worksheet Functions 2 January 11th 05 11:01 PM


All times are GMT +1. The time now is 11:23 PM.

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"