SUMIF Criteria

J

JC

I'm trying to use the SUMIF function with criteria that value must be >30 and
<=60. How would I code that with this function?
 
B

bpeltzer

Use two sumif functions... one adds up everything over 30, the other
everything over 60. Subtract to get those in (30-60]
=sumif(range,">30",sum_range) - sumif(range,">60",sum_range)
 
G

Gary''s Student

For example, in A1 thru A5:

29
30
40
60
61

=SUMPRODUCT(A1:A5*(A1:A5>30)*(A1:A5<=60))
displays 100
 
A

akphidelt

Try using sumproduct. suppose your data was in A1:A100 you would write the
formula

=Sumproduct((A1:A100>30)*(A1:A100<=60)*A1:A100)
 
D

dan dungan

If your data is in Column A, would this formula work for you?

=IF(AND(SUM(A13>30),SUM(A13<=60)),SUM(A13),0)

Dan
 
D

David Biddulph

What value do the 3 uses of the SUM() function add to your formula, Dan?
What does that formula do that you wouldn't get from
=IF(AND(A13>30,A13<=60),A13,0) ?
[You may perhaps like to look at Excel help for the SUM function, to remind
yourself that SUM takes a list of arguments and SUMs them. If you give the
SUM function only one argument, as in each of your 3 cases, the SUM is
trivial.]

Additionally, neither formula actually addresses the OP's requirement for a
SUMIF function, as you haven't actually done a SUM, and you've addressed
only one cell. Hence the SUMPRODUCT solution, or subtracting one SUMIF from
another, would seem more appropriate.
 

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