Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Divide by the minimum non-zero number in a range of cells

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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default Divide by the minimum non-zero number in a range of cells

=MIN(IF(A1:A10;A1:A10))

this is an array-formula so CTRL+SHIFT+ENTER instead of simply
entering it



On 13 Cze, 11:13, 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.


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,520
Default Divide by the minimum non-zero number in a range of cells

Suppose you have the numbers in Column A use the below formula to return the
minimum non zero number. Hope you dont have negative numbers..

=SMALL(A:A,COUNTIF(A:A,0)+1)

If this post helps click Yes
---------------
Jacob Skaria


"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.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 341
Default Divide by the minimum non-zero number in a range of cells

Hello Opus,

This works, assuming your data is in cells A1 to G1.

=MIN(IF($A$1:$G$1=0,MAX($A$1:$G$1),$A$1:$G$1))

You have to submit it as an array formula (type the formula then press
Ctrl+Shift+Enter).

What it does is look at all the values individually, and any time it finds a
zero it thinks about it as the biggest number in the range instead (thereby
excluding it from the MIN).
--
If you found this post helpful, please click "Yes".
Allllen


"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.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 341
Default Divide by the minimum non-zero number in a range of cells

This works, assuming your data is in cells A1 to G1.

=MIN(IF($A$1:$G$1=0,MAX($A$1:$G$1),$A$1:$G$1))

You have to submit it as an array formula (type the formula then press
Ctrl+Shift+Enter).

What it does is look at all the values individually, and any time it finds a
zero it thinks about it as the biggest number in the range instead (thereby
excluding it from the MIN).
--
If you found this post helpful, please click "Yes".
Allllen


"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.



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Divide by the minimum non-zero number in a range of cells

=MIN(IF(A1:A10<0,A1:A10))

NOTE:

This is an array formula that must be entered with CNTRL-SHFT-ENTER instead
of just the ENTER key.
--
Gary''s Student - gsnu200856


"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.

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 341
Default Divide by the minimum non-zero number in a range of cells

=MIN(IF(a1:g1=0,max(a1:g1),a1:g1)
array formula: press ctrl+shift and enter to submit it
--
If you found this post helpful, please click "Yes".
Allllen


"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.

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Divide by the minimum non-zero number in a range of cells

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.

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Divide by the minimum non-zero number in a range of cells


Shane Devenshire;380163 Wrote:
If you don't want an array formula try this

=SUMPRODUCT((A1:A7<0)*(MIN(A1:A7)=A1:A7)*A1:A7)


Surely that won't always return the correct result? If all cells A1:A7
contain the number 1 then that formula will give you 7


--
barry houdini
------------------------------------------------------------------------
barry houdini's Profile: http://www.thecodecage.com/forumz/member.php?userid=72
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=106326

  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Divide by the minimum non-zero number in a range of cells

"Shane Devenshire" wrote:
If you don't want an array formula try this
=SUMPRODUCT((A1:A7<0)*(MIN(A1:A7)=A1:A7)*A1:A7)


Doesn't work for me. Test with A1:A7 = {0,3,3,2,3,3,0}. Returns zero. It
is easy to see why: MIN(A1:A7) is a constant, namely the smallest in the
range. Since that would be zero, the very case that the OP wants to
exclude, the SUMPRODUCT should always be zero.


----- original message -----

"Shane Devenshire" wrote in
message ...
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.




  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default Divide by the minimum non-zero number in a range of cells

corrected:

=MIN(IF(A1:A10,A1:A10))



On 13 Cze, 12:10, Jarek Kujawa wrote:
=MIN(IF(A1:A10;A1:A10))

this is an array-formula so CTRL+SHIFT+ENTER instead of simply
entering it

On 13 Cze, 11:13, 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.- Ukryj cytowany tekst -


- Pokaż cytowany tekst -


  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Divide by the minimum non-zero number in a range of cells

If you don't want an array formula

Assuming there will always be at least 1 non-zero cell and there's no text
in the range:

=MIN(INDEX(((A1:A7<0)*A1:A7)+((A1:A7=0)*1E+100),, 1))

--
Biff
Microsoft Excel MVP


"Shane Devenshire" wrote in
message ...
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.



  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Divide by the minimum non-zero number in a range of cells

=MIN(INDEX(10^10-(A1:A7<0)*(10^10-A1:A7),))

Just press ENTER


"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.

  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Divide by the minimum non-zero number in a range of cells

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.

  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Divide by the minimum non-zero number in a range of cells

Thank you all for your replies. This is what occured to me late last night
and what I wound up doing:

I realized that what I was looking for here was the Maximum number resulting
from dividing a constant by the Minimum number in a range. So I did

=IF(A1=0,"",Constant/A1)

and copied it for each cell in my original range creating a range of results
in a separate column B that I later hid. This weeded out all the cells
containing zero.

I then used

=Max(B1:B10)

to obtain the result I was actually after.


"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.



  #16   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Divide by the minimum non-zero number in a range of cells

"T. Valko" wrote:
=MIN(INDEX(((A1:A7<0)*A1:A7)+((A1:A7=0)*1E+100),, 1))


I think this is the most reliable expressions of this ilk; "reliable"
because I believe it works for all values in A1:A7 less then 1E100, even if
MIN(A1:A7) is 2^53 or more less than 1E100.

However, I believe that expression fails if MIN(A1:A7) is greater than
1E100. Moreover, it can be simplified. I believe the following is more
reliable:

=min(index(A1:A7+2*max(A1:A7)*(A1:A7=0),,1))

I believe that works as long as MAX(A1:A7) is less than 2^1023.

We could extend the allowed numerical range for A1:A7 somewhat by replacing
"2*" with a smaller factor larger than 1; the smallest constant factor is
1.00000000000001. But it does not seem to be worth the trouble.

PS: Personally, I don't feel that any of this is worth the trouble just to
avoid the straight-forward array formula, as much as I dislike array
formulas in general.


----- original message -----

"T. Valko" wrote in message
...
If you don't want an array formula


Assuming there will always be at least 1 non-zero cell and there's no text
in the range:

=MIN(INDEX(((A1:A7<0)*A1:A7)+((A1:A7=0)*1E+100),, 1))

--
Biff
Microsoft Excel MVP


"Shane Devenshire" wrote in
message ...
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.




  #17   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Divide by the minimum non-zero number in a range of cells

"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.


  #18   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Divide by the minimum non-zero number in a range of cells

"Teethless mama" wrote:
=MIN(INDEX(10^10-(A1:A7<0)*(10^10-A1:A7),))


As I noted in my comments about Biff's (T.Valko's) formula, expressions of
this ilk limit MAX(A1:A7) to whatever factor you use, 10^10 in your case.
(Why not simply write 1E10?)

But your expression suffers from the additional limitation that MIN(A1:A7)
cannot be more than about 2^52 less than 1E10 or whatever factor you choose.

Arguably, since the OP is worried about a minimum of zero (sometimes?), you
might think that MIN(A1:A7) cannot be 2^52 less than 1E10. (But is the
operative word "sometimes"?) But considering my first comment, ironically
it behooves you to choose a larger factor, unless the OP gives us an upper
bound.

Much ado about nothing. Personally, I don't feel that any of this is worth
the trouble just to avoid the straight-forward array formula, as much as I
dislike array formulas in general.


---- original message -----

"Teethless mama" wrote in message
...
=MIN(INDEX(10^10-(A1:A7<0)*(10^10-A1:A7),))

Just press ENTER


"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.


  #19   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Divide by the minimum non-zero number in a range of cells

PS: Personally, I don't feel that any of this is worth the
trouble just to avoid the straight-forward array formula


I agree completely. It was just an academic exercise.

--
Biff
Microsoft Excel MVP


"JoeU2004" wrote in message
...
"T. Valko" wrote:
=MIN(INDEX(((A1:A7<0)*A1:A7)+((A1:A7=0)*1E+100),, 1))


I think this is the most reliable expressions of this ilk; "reliable"
because I believe it works for all values in A1:A7 less then 1E100, even
if MIN(A1:A7) is 2^53 or more less than 1E100.

However, I believe that expression fails if MIN(A1:A7) is greater than
1E100. Moreover, it can be simplified. I believe the following is more
reliable:

=min(index(A1:A7+2*max(A1:A7)*(A1:A7=0),,1))

I believe that works as long as MAX(A1:A7) is less than 2^1023.

We could extend the allowed numerical range for A1:A7 somewhat by
replacing "2*" with a smaller factor larger than 1; the smallest constant
factor is 1.00000000000001. But it does not seem to be worth the trouble.

PS: Personally, I don't feel that any of this is worth the trouble just
to avoid the straight-forward array formula, as much as I dislike array
formulas in general.


----- original message -----

"T. Valko" wrote in message
...
If you don't want an array formula


Assuming there will always be at least 1 non-zero cell and there's no
text in the range:

=MIN(INDEX(((A1:A7<0)*A1:A7)+((A1:A7=0)*1E+100),, 1))

--
Biff
Microsoft Excel MVP


"Shane Devenshire" wrote in
message ...
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.






  #20   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default Divide by the minimum non-zero number in a range of cells

"T. Valko" wrote:
PS: Personally, I don't feel that any of this is worth the
trouble just to avoid the straight-forward array formula


I agree completely. It was just an academic exercise.


Likewise. Always fun ;-). Also gives us a chance to learn new approaches.


----- original message -----

"T. Valko" wrote in message
...
PS: Personally, I don't feel that any of this is worth the
trouble just to avoid the straight-forward array formula


I agree completely. It was just an academic exercise.

--
Biff
Microsoft Excel MVP


"JoeU2004" wrote in message
...
"T. Valko" wrote:
=MIN(INDEX(((A1:A7<0)*A1:A7)+((A1:A7=0)*1E+100),, 1))


I think this is the most reliable expressions of this ilk; "reliable"
because I believe it works for all values in A1:A7 less then 1E100, even
if MIN(A1:A7) is 2^53 or more less than 1E100.

However, I believe that expression fails if MIN(A1:A7) is greater than
1E100. Moreover, it can be simplified. I believe the following is more
reliable:

=min(index(A1:A7+2*max(A1:A7)*(A1:A7=0),,1))

I believe that works as long as MAX(A1:A7) is less than 2^1023.

We could extend the allowed numerical range for A1:A7 somewhat by
replacing "2*" with a smaller factor larger than 1; the smallest constant
factor is 1.00000000000001. But it does not seem to be worth the
trouble.

PS: Personally, I don't feel that any of this is worth the trouble just
to avoid the straight-forward array formula, as much as I dislike array
formulas in general.


----- original message -----

"T. Valko" wrote in message
...
If you don't want an array formula

Assuming there will always be at least 1 non-zero cell and there's no
text in the range:

=MIN(INDEX(((A1:A7<0)*A1:A7)+((A1:A7=0)*1E+100),, 1))

--
Biff
Microsoft Excel MVP


"Shane Devenshire" wrote in
message ...
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.








  #21   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Divide by the minimum non-zero number in a range of cells

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.



  #22   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Divide by the minimum non-zero number in a range of cells

Hi,

Althought this turned out to be a very interested thread for all of us, I
recommend that in the future you post the actual question you are trying to
solve. Your solution of using a hidden column/ an extra column of course is
not necessary. You can modify the single cell solutions we have developed
for your problem to work for your real problem. Now you are doing a max if.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Opus" wrote:

Thank you all for your replies. This is what occured to me late last night
and what I wound up doing:

I realized that what I was looking for here was the Maximum number resulting
from dividing a constant by the Minimum number in a range. So I did

=IF(A1=0,"",Constant/A1)

and copied it for each cell in my original range creating a range of results
in a separate column B that I later hid. This weeded out all the cells
containing zero.

I then used

=Max(B1:B10)

to obtain the result I was actually after.


"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.

  #23   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,059
Default 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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding Minimum but if same number repeats in the range, then find MIK Excel Discussion (Misc queries) 1 January 9th 09 03:13 AM
Get a row number of range where a value is between minimum and max Tetsuya Oguma Excel Worksheet Functions 2 October 1st 08 01:00 AM
Divide a range of cells by a number Kate Excel Discussion (Misc queries) 3 May 3rd 08 06:36 PM
Return the minimum number in a range excluding zero Jive Excel Worksheet Functions 3 November 8th 07 01:41 PM
divide all numbers in range by a fixed number dhig3903 Excel Discussion (Misc queries) 2 August 9th 06 08:04 AM


All times are GMT +1. The time now is 07:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"