Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 454
Default Conditional SUM Q

I have the following data layout

Col A to E (Row 5) with values say, 10,15,20,25,30

Coll A to E (Row 7) has values say, 15,10,10,30,35

Col A to E (Row 9) returns an "Under" or " " (blank) depending if Row
5 is more or less than Row 7. Thus A9 would show "Under"; D9 would
show "Under" and E9 would show "Under". B & C would show " ".

What I wish t do is add up the difference between A to E Row 5 and Row
7, but ONLY if Row 5 is less than Row 7 i.e. those colmns that show
"Under".

How would I do that via a formula? Hope I am making sense

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Conditional SUM Q

In A9 write

=IF(A5<A7,"Under","")

Then drag it to the right till column E.

I hope I understood the question correctly. Let me know if it works.

Thanks.


"Sean" wrote in message
ups.com...
I have the following data layout

Col A to E (Row 5) with values say, 10,15,20,25,30

Coll A to E (Row 7) has values say, 15,10,10,30,35

Col A to E (Row 9) returns an "Under" or " " (blank) depending if Row
5 is more or less than Row 7. Thus A9 would show "Under"; D9 would
show "Under" and E9 would show "Under". B & C would show " ".

What I wish t do is add up the difference between A to E Row 5 and Row
7, but ONLY if Row 5 is less than Row 7 i.e. those colmns that show
"Under".

How would I do that via a formula? Hope I am making sense



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default Conditional SUM Q

or if you want to add row 5 and 7 only if the value in row 5 is less than
row 7...

=IF(A5<A7,SUM(A5,A7),"")

Drag it till column E.


"Gary" wrote in message
...
In A9 write

=IF(A5<A7,"Under","")

Then drag it to the right till column E.

I hope I understood the question correctly. Let me know if it works.

Thanks.


"Sean" wrote in message
ups.com...
I have the following data layout

Col A to E (Row 5) with values say, 10,15,20,25,30

Coll A to E (Row 7) has values say, 15,10,10,30,35

Col A to E (Row 9) returns an "Under" or " " (blank) depending if Row
5 is more or less than Row 7. Thus A9 would show "Under"; D9 would
show "Under" and E9 would show "Under". B & C would show " ".

What I wish t do is add up the difference between A to E Row 5 and Row
7, but ONLY if Row 5 is less than Row 7 i.e. those colmns that show
"Under".

How would I do that via a formula? Hope I am making sense





  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,345
Default Conditional SUM Q

If you mean add up the differences between the rows when row 5 is smaller
than row 7 then without any other steps try:

=SUMPRODUCT((A5:E5<A7:E7)*(A7:E7-A5:E5))

Answer 15.

If you mean add up row 7 where it is greater than row 5 then try:

=SUMPRODUCT((A5:E5<A7:E7)*A7:E7)

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Sean" wrote in message
ups.com...
I have the following data layout

Col A to E (Row 5) with values say, 10,15,20,25,30

Coll A to E (Row 7) has values say, 15,10,10,30,35

Col A to E (Row 9) returns an "Under" or " " (blank) depending if Row
5 is more or less than Row 7. Thus A9 would show "Under"; D9 would
show "Under" and E9 would show "Under". B & C would show " ".

What I wish t do is add up the difference between A to E Row 5 and Row
7, but ONLY if Row 5 is less than Row 7 i.e. those colmns that show
"Under".

How would I do that via a formula? Hope I am making sense




  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 454
Default Conditional SUM Q

Thanks everyone. I'm going to pick Sandys as that returns the value in
one cell which I'm looing for






  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Conditional SUM Q

One way:

=SUMPRODUCT(--(A7:E7A5:E5),(A7:E7-A5:E5))

In article . com,
Sean wrote:

I have the following data layout

Col A to E (Row 5) with values say, 10,15,20,25,30

Coll A to E (Row 7) has values say, 15,10,10,30,35

Col A to E (Row 9) returns an "Under" or " " (blank) depending if Row
5 is more or less than Row 7. Thus A9 would show "Under"; D9 would
show "Under" and E9 would show "Under". B & C would show " ".

What I wish t do is add up the difference between A to E Row 5 and Row
7, but ONLY if Row 5 is less than Row 7 i.e. those colmns that show
"Under".

How would I do that via a formula? Hope I am making sense

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 454
Default Conditional SUM Q

One question, what is the difference with the way the following is
expressed?

=SUMPRODUCT((A5:E5<A7:E7)*(A7:E7-A5:E5))

and

=SUMPRODUCT(--(A7:E7A5:E5),(A7:E7-A5:E5))

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Conditional SUM Q

The form

=SUMPRODUCT(--(A7:E7A5:E5),(A7:E7-A5:E5))

is the form in which the SUMPRODUCT function multiplies two arrays
together (the result of --(A7:E7A5:E5) and t he result of
(A7:E7-A5:E5)) and adds the resulting array - see

http://www.mcgimpsey.com/excel/doubleneg.html

The form

=SUMPRODUCT((A5:E5<A7:E7)*(A7:E7-A5:E5))

first multiplies the arrays, then passes the result off to the
SUMPRODUCT function, which adds the values in the array.

Practically, there's not very much difference, though testing found that
the first form was marginally faster. You probably won't notice a
difference on a modern machine until you start having large numbers of
SUMPRODUCT functions with large arrays.




In article . com,
Sean wrote:

One question, what is the difference with the way the following is
expressed?

=SUMPRODUCT((A5:E5<A7:E7)*(A7:E7-A5:E5))

and

=SUMPRODUCT(--(A7:E7A5:E5),(A7:E7-A5:E5))

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
Conditional Rank (or rather, Conditional Range) [email protected] Excel Worksheet Functions 6 April 16th 07 06:15 PM
Conditional Min Value VictorMuraw Excel Discussion (Misc queries) 2 December 11th 06 06:47 PM
Conditional Sum Help techiemom60 Excel Worksheet Functions 3 March 22nd 06 01:21 AM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM
conditional max Brian Cornejo Excel Discussion (Misc queries) 1 February 19th 05 03:33 AM


All times are GMT +1. The time now is 05:58 PM.

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

About Us

"It's about Microsoft Excel"