Divide by the minimum non-zero number in a range of cells
"Shane Devenshire" wrote:
Or after some thought how about just
=SUMPRODUCT(MIN(2*(A1:A8=0)+A1:A8))
Perhaps you should do less "thought" and more testing. Try A1:A8 equal to
{0,3,3,3,3,3,3,0}. Klunk!
Anyway, I think the horse is dead.
----- original message -----
"Shane Devenshire" wrote in
message ...
Hi,
Or after some thought how about just
=SUMPRODUCT(MIN(2*(A1:A8=0)+A1:A8))
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
"JoeU2004" wrote:
"Shane Devenshire" wrote:
=SUMPRODUCT(MIN(9^9*(A1:A8=0)+A1:A8))
Why 9^9? Why not something more straight-forward like 10^10? That can
written as the constant 1E10?
And why is this any better than Biff's (T.Valko's) formulation that uses
MIN(INDEX(...))? I presume you saw his, since you posted your follow-up
more than 4 hours later to the same news server, I believe.
In any case, as I noted regarding Biff's formula, expressions of this ilk
limit MAX(A1:A8) to whatever factor you use, be it 9^9, 1E10 or 1E100.
So
it would behoove you to use a larger factor like 1E10 or even 1E100.
And to that end, I think it would be better to replace any constant
factor
(e.g. 9^9) with 2*max(A1:A8). That limits MAX(A1:A8) to 2^1023, about
half
the biggest value allowed.
I also noted that we can extend the range of values for MAX(A1:A8) by
replacing the factor 2 with a smaller factor larger than 1; the smallest
constant factor is 1.00000000000001.
But none of this seems to be worth the trouble just to avoid the
straight-forward array formula solution, as much as I don't like array
formulas myself.
----- original message -----
"Shane Devenshire" wrote in
message ...
Well that's pretty interesting, unfortunately I cleared my test range
and
can't duplicate the original results.
Alternative:
=SUMPRODUCT(MIN(9^9*(A1:A8=0)+A1:A8))
hopefully this is a little better.
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
"Shane Devenshire" wrote:
Hi,
If you don't want an array formula try this
=SUMPRODUCT((A1:A7<0)*(MIN(A1:A7)=A1:A7)*A1:A7)
--
If this helps, please click the Yes button.
Cheers,
Shane Devenshire
"Opus" wrote:
I need to find the minimum non-zero number in a range of cells that
contains
some zeroes. So that I can divide by the minimum number. Any
ideas?
If I just use the MIN function, it returns a value of 0, then when
my
formula divides by that I get the divide by zero error.
|