sumif

H

Harvey Waxman

I have two columns of numbers. The difference between each pair can be greater
than zero, less than zero or zero.

I'd like to find the total of all the greater than zeros without actually
having a column of the differences, if possible.

Is it doable?
 
J

JE McGimpsey

Harvey Waxman said:
I have two columns of numbers. The difference between each pair can be
greater
than zero, less than zero or zero.

I'd like to find the total of all the greater than zeros without actually
having a column of the differences, if possible.

One way:

=SUMPRODUCT(--(A1:A100>B1:B100),A1:A100-B1:B100)
 
H

Harvey Waxman

JE McGimpsey said:
One way:

=SUMPRODUCT(--(A1:A100>B1:B100),A1:A100-B1:B100)

Thanks, what about less than zero's? I tried variations with no success
because the logic escapes me at first blush.
 
J

JE McGimpsey

One way:

=SUMPRODUCT(--(A1:A100>B1:B100),A1:A100-B1:B100)

Thanks, what about less than zero's? I tried variations with no success
because the logic escapes me at first blush.[/QUOTE]

One way:

=SUMPRODUCT(--(A1:A100<B1:B100),A1:A100-B1:B100)

or, if you want to have the absolute value:

=-SUMPRODUCT(--(A1:A100<B1:B100),A1:A100-B1:B100)

You could do the latter slightly more efficiently as

=SUMPRODUCT(-(A1:A100<B1:B100),A1:A100-B1:B100)
 
H

Harvey Waxman

JE McGimpsey said:
Thanks, what about less than zero's? I tried variations with no success
because the logic escapes me at first blush.

One way:

=SUMPRODUCT(--(A1:A100<B1:B100),A1:A100-B1:B100)

or, if you want to have the absolute value:

=-SUMPRODUCT(--(A1:A100<B1:B100),A1:A100-B1:B100)

You could do the latter slightly more efficiently as

=SUMPRODUCT(-(A1:A100<B1:B100),A1:A100-B1:B100)[/QUOTE]

Once again, thanks
 

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

Top