#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default conditional sum

date cost $ sales $
01/21/09 $4.00 $8.00
01/21/09 $7.00
02/21/09 $5.00 $8.00
02/28/09 $3.00

what formula can I use to look at the "date" column, select a time period
(i.e 01/01/09-01/31/09) and sum the the corresponding "Sales $" only if the
"cost $" is <"" ?

thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default conditional sum

=sumproduct(--(text(a1:a10,"yyyymm")="200901"),--(b1:b10<""),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

=======
And if you're using xl2007, you may want to look at =sumifs() in excel's help.

joe@malvern wrote:

date cost $ sales $
01/21/09 $4.00 $8.00
01/21/09 $7.00
02/21/09 $5.00 $8.00
02/28/09 $3.00

what formula can I use to look at the "date" column, select a time period
(i.e 01/01/09-01/31/09) and sum the the corresponding "Sales $" only if the
"cost $" is <"" ?

thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default conditional sum

Try this:

Use cells to hold the date boundaries.

E1 = start date
F1 = end date

=SUMPRODUCT(--(A1:A10=E1),--(A1:A10<=F1),--(B1:B10<""),C1:C10)

--
Biff
Microsoft Excel MVP


"joe@malvern" wrote in message
...
date cost $ sales $
01/21/09 $4.00 $8.00
01/21/09 $7.00
02/21/09 $5.00 $8.00
02/28/09 $3.00

what formula can I use to look at the "date" column, select a time period
(i.e 01/01/09-01/31/09) and sum the the corresponding "Sales $" only if
the
"cost $" is <"" ?

thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default conditional sum

Something like:

=SUMPRODUCT(--(A1:A100DATEVALUE("1/1/2009"))*--(A1:A100<DATEVALUE("1/31/2009"))*--(B1:B100<""),(C1:C100))

--
Gary''s Student - gsnu200842


"joe@malvern" wrote:

date cost $ sales $
01/21/09 $4.00 $8.00
01/21/09 $7.00
02/21/09 $5.00 $8.00
02/28/09 $3.00

what formula can I use to look at the "date" column, select a time period
(i.e 01/01/09-01/31/09) and sum the the corresponding "Sales $" only if the
"cost $" is <"" ?

thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 20
Default conditional sum

Dave...worked perfect...thanks!!

"Dave Peterson" wrote:

=sumproduct(--(text(a1:a10,"yyyymm")="200901"),--(b1:b10<""),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

=======
And if you're using xl2007, you may want to look at =sumifs() in excel's help.

joe@malvern wrote:

date cost $ sales $
01/21/09 $4.00 $8.00
01/21/09 $7.00
02/21/09 $5.00 $8.00
02/28/09 $3.00

what formula can I use to look at the "date" column, select a time period
(i.e 01/01/09-01/31/09) and sum the the corresponding "Sales $" only if the
"cost $" is <"" ?

thanks


--

Dave Peterson

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
New Conditional Format Overriding Previous Conditional Format Rene Excel Discussion (Misc queries) 3 February 27th 08 06:08 PM
Conditional Rank (or rather, Conditional Range) [email protected] Excel Worksheet Functions 6 April 16th 07 06:15 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 12:27 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"