If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
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:A70)*(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
|
|||
|
|||
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
|
|||
|
|||
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:A70)*(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. |
Thread Tools | |
Display Modes | |
|
|