Sum based on specific condition

G

Guest

one way is to create another column in E and use the following in column E.
=IF(A1>B1,D1,0)
Your could then sum column E.

Tom
 
G

Guest

With your data starting in cell A1 (adjust formula if needed), I believe this
will work:

=SUMPRODUCT(--(A1:A9>B1:B9),D1:D9)

The function sumproduct multiplies the pairs together and then sums all
those products. The first argument evaluates whether the data in A is
greater then its partner in B; if so, the result is 1, and if not, the result
is 0. The second argument is just the data in D, which then gets multiplied
by the 1's and 0's, and then summed.

HTH
 
G

Guest

I replied to this a while ago with a longer explanation, but don't see that
post yet. Here's the short version, but I can elaborate if needed. Assuming
your data starts in A!, try the following:

=SUMPRODUCT(--(A1:A9>B1:B9),D1:D9)

HTH
 
G

Guest

I got a notification of a response to this thread, but there's nothing here.
Something very odd is going on.
 
G

Guest

Try =SUMPRODUCT(--((A1:A9)>(B1:B9)),D1:D9)

I posted this yesterday, but don't see it or any other replies, so I am
reposting it.

Hope this helps,

Hutch
 
G

Guest

Hi Wendy,

I've copied this table into Excel A1 : E10.

I'd add a 6th column (E): with this formula:

=IF(B2>C2,"x","")

It will put an 'x' into any cell where ColumnHeadingA is greater than
ColumnHeadingB

Then I'd put the following total at the foot of ColumnHeadingD:

=SUMIF(F2:F10,"x",E2:E10)


I don't usually respond, so I hope this makes sense (and works!)

Kind regards

Amanda
 
D

David Biddulph

The "something very odd" which is going on is that Microsoft's web interface
to the newsgroups is broken.

You'll see the messages if you use a newsreader or Google's archives.

But as all the people who are asking the questions about this problem are
the people who are using the Microsoft web interface, they are not seeing
the replies to their questions. :-(
--
David Biddulph

Barb Reinhardt said:
I got a notification of a response to this thread, but there's nothing
here.
Something very odd is going on.
....
 
G

Guest

Here's one way
(A) (B) (C) (D) (E)
1 6942 292 0.81 5614.84 =IF(B2>C2,E2,"")
2 317 0 0.92 292.87 =IF(B3>C3,E3,"")
3 6207 20374 7.64 47421.48 =IF(B4>C4,E4,"")
4 417 17588 5.84 2435.28 =IF(B5>C5,E5,"")
5 43921 108193 1.01 44525.47 =IF(B6>C6,E6,"")
6 5974 15883 3.11 18579.14 =IF(B7>C7,E7,"")
7 1834 7062 1.79 3283.57 =IF(B8>C8,E8,"")
8 665 733 2.13 1416.76 =IF(B9>C9,E9,"")
9 21855 24149 1.7 37153 =IF(B10>C10,E10,"")
=SUM(F2:F10)
 
G

Guest

Hi Wendy-

In column E, I created an if statement =IF(A1>B1,1,0) in each row that
contains data and then at bottom of data in column D, I created an sumif
statement =SUMIF(E1:E9,"=1",D1:D9).

This seems to do what you want
 
P

Peo Sjoblom

Gee! Will this never end? (no offence to the poster since I assume he can't
see all previous answers although the date of the original post should shed
some light)
 
G

Guest

Try =SUMPRODUCT(--(A1:A9>B1:B9)*(D1:D9))
--
John
MOS Master Instructor Office 2000, 2002 & 2003
Please reply & rate any replies you get

Ice Hockey rules (especially the Wightlink Raiders)
 
G

Guest

hi,
I would use a helper column. in column E, I would put this formula...
=IF(A1>B1,D1,"")
Copy down then sum column E.

Regards
FSt1
 
G

Guest

This may not be exactly what you want, but it works: Make a column E and use
the following if then statement =IF(A1>B1,D1," ") (Like I said not pretty,
but it works!)

6942 292 0.81 5614.84 5614.84
317 0 0.92 292.87 292.87
6207 20374 7.64 47421.48
417 17588 5.84 2435.28
43921 108193 1.01 44525.47
5974 15883 3.11 18579.14
1834 7062 1.79 3283.57
665 733 2.13 1416.76
21855 24149 1.7 37153
5907.71
Hope that helps!
 
G

Guest

The cheating way would be to write an if statement in column
E....=if(A1>b1,D1,0). This formula will give you only those cells in Column
D if column A is greater then column B. Then you can simply add column E
 
G

Guest

Try this:
Insert another column (E); this column shall contain the difference between
the values in (A) and (B); it is important that you subtract (B) from (A) and
not (A) from (B).
In the cell where you want to put the desired sum, type:
=sumif(E1:E9,">0",D1:D9)
In your example, it will yield 5,907.71.
Is there a chance that values in (A) and (B) will be equal? If no, this will
work.


(A) (B) (C) (D)
(E)
 
G

Guest

Hi,

Since the system is down I can't see if you got a response to this one so
here it is:

=SUM((A1:A9>B1:B9)*D1:D9)

Press Ctrl+Shift+Enter rather than just Enter

or

=SUMPRODUCT((A1:A9>B1:B9)*D1:D9)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Need to 'COUNT'... 5

Top