Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Problems with sum + if

Hi,

I have been trying to sum from a column after it meets three conditions. I
have tried three things now and I can't get any of them to work.

The first thing I tried was to take it through a conditional sum wizard, and
my formula looks like this:

=SUM(IF($A$3:$A$55="S",IF($C$3:$C$55=-12.5,IF($D$3:$D$55="SEP06MAR07",$B$3:$B$55,0),0),0 ))

What I would like for it to do is add the value from column c only when the
same row value in column b is "S", when column d is "SEP06MAR07", and when
column C is -12.5, but for some reason it's not working.

Then I tried to make it myself with:

=SUM(IF(($A$3:$A$55=I$2)*($C$3:$C$55=$G4)*($D$3:$D $55=$G$2),$B$3:$B$55,0))

where I$2 = S, $G4 = -12.5, and $G$2 = SEP06MAR07.
I think that because the first row in the database satisfies these
conditions, it is summing up the entire column b.

I have also tried to use the DSUM method:

=DSUM(A2:D55,"QUAN",G6:I7)

Where "QUAN" serves as the title for the column I would like to be summed
and G6:17 looks like:

B/S PRICE TYPE
S -12.5 =SEP06MAR07

I have tried all 3 and I can't seem to get any of them to work. Any help you
can give me?

Thanks,
Darren
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problems with sum + if


I'm not sure I fully understood what you needed. More particularly I a
unsure of what you wanted actually summed. This formula below wil
perform the 'sum' operation when B2=S, D2=SEP06MAR07, and C2=-12.5.
You will want to edit the actual SUM function though, because like
said, I am not sure what you wanted added together.

=if(B2="S",if(D2="SEP06MAR07",if(C2=-12.5,sum(B2:C3),""),""),"")

Is that anything close to what you wanted done

--
ph
-----------------------------------------------------------------------
ph8's Profile: http://www.excelforum.com/member.php...fo&userid=1987
View this thread: http://www.excelforum.com/showthread.php?threadid=52512

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Problems with sum + if

Actually, what I'd like to do is sum all the cells down column b whose
corresponding rows satisfy the three conditions described in the formulas I
have been trying to use.

Basically, column b has quantities of a certain product ("SEP06MAR07"
condition) bought or sold ("S" condition) at a certain price (-12.5
condition) and that information is contained in the same row as the cell I
want to evaluate to be summed all the way down the database. So, something
like this:

B/S QUAN PRICE TYPE
S 3 -12.5 SEP06MAR07
S 3 -12.5 SEP06MAR07
S 2 -7.5 DEC06MAR07
S 2 -7.5 DEC06MAR07
S 3 -7.5 DEC06MAR07
S 7 -7.5 DEC06MAR07
S 3 -7.5 DEC06MAR07
S 2 0.5 DEC07MAR08
S 3 0.5 DEC07MAR08
S 2 0.5 DEC07MAR08
S 2 -5 SEP06DEC06
S 2 -7.5 DEC06MAR07
B 10 -13 SEP06MAR07
B 7 0.5 SEP07MAR08
S 14 -12.5 SEP06MAR07

What I would like to do is add the cell value in column QUAN whenever the
conditions are met in the corresponding row all the way down the column. So,
for the particular example, I would hope to have the cell that the formula is
in to return the value 20 based on the required conditions.



"ph8" wrote:


I'm not sure I fully understood what you needed. More particularly I am
unsure of what you wanted actually summed. This formula below will
perform the 'sum' operation when B2=S, D2=SEP06MAR07, and C2=-12.5.
You will want to edit the actual SUM function though, because like I
said, I am not sure what you wanted added together.

=if(B2="S",if(D2="SEP06MAR07",if(C2=-12.5,sum(B2:C3),""),""),"")

Is that anything close to what you wanted done?


--
ph8
------------------------------------------------------------------------
ph8's Profile: http://www.excelforum.com/member.php...o&userid=19871
View this thread: http://www.excelforum.com/showthread...hreadid=525124


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problems with sum + if


With your matrix pasted in to cells A1 thru D16, and each of the column
given a range name (rows 2 to 16 only), then in any cell type:

=SUMPRODUCT((BS="S")*(PRICE=-12.5)*(TYPE="SEP06MAR07")*QUAN)

which should give an answer of 20.

Regards
Mik

--
Mikeopol
-----------------------------------------------------------------------
Mikeopolo's Profile: http://www.excelforum.com/member.php...fo&userid=1857
View this thread: http://www.excelforum.com/showthread.php?threadid=52512

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
aauugghhh...#div/o problems & various average formula problems acbel40 Excel Worksheet Functions 5 October 19th 09 05:00 PM
More zip + 4 problems dm Excel Discussion (Misc queries) 1 September 11th 06 11:28 PM
Problems using Add-in Trefor Excel Programming 2 November 25th 05 02:31 AM
Tab key problems Marilyn Excel Discussion (Misc queries) 4 November 18th 05 05:32 PM
Problems merging an excel file due to code or file problems? Cindy M -WordMVP- Excel Programming 0 September 14th 04 02:58 PM


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