PDA

View Full Version : Solved: SUMIF or vba workaround



Aussiebear
01-07-2011, 05:49 AM
The function SUMIF works on the premise that you have a range, criteria, and the optional argument of the sum range as in

=SUMIF(A:A,">=0", A:A)

which in this case could just as easily be written as

=SUMIF(A:A,">=0")

However this requires you to know the value of the criteria to base the summing on. My question is this, what happens if your criteria is a variable, and that variable resides in a cell outside of the current range to be summed?

Since Excel won't allow me to write something like this;

=SUMIF(A:A,">=$B$4",A:A)

where cell $B$4 contains a variable that I wish to alter to test an outcome. Do I need a vba workaround or am I missing something in this issue?

Aflatoon
01-07-2011, 06:12 AM
You need to & it in:
=SUMIF(A:A,">="&$B$4,A:A)

Bob Phillips
01-07-2011, 06:16 AM
If the sum-range is the same as the criteria_range, you can omit it

=SUMIF(A:A,">="&$B$4)

Aussiebear
01-07-2011, 02:25 PM
Thank you