Hi.
You guys introduced me to arrays/matrix use in excel the other day and I'm pretty happy about it. They open-up all kinds of ways to make my ideas more user-friendly. I am running into one problem though. I modified the formula I was given and nested another "if" and "lookup", but I have found a problem. For some numbers, this formula results in what is in effect a rounding error. In the following formula I have used 10.78 as the input cost and a margin of 23 (indicated by /.77) and the result is 14 on the nose. The problem is that the formula spits out 14.99 where the desired result is 13.99. If you go up to 10.79 the formula spits out 14.49 (this is the desired result). It should subtract 1 from the integer as well as placing 99 to the right of the decimal when in effect it is rounding down. I can't figure out how to do it right. I am guessing the answer is easier than I think, but my brain is fried. Maybe I should just use mround for the >=10 through <15 part, but I'd likely run into the same problem with the integer separated at the beginning.
=INT((10.78/0.77))+IF(((10.78/0.77))<10, LOOKUP(MOD((10.78/0.77), 1)+0.001,{0,30,50,70,80,90}%,{29,49,69,79,89,99}%),IF(AND(((10.78/0.77))>=10,((10.78/0.77))<15),LOOKUP(MOD((10.78/0.77),1)+0.001,{0,0.01,50}%,{-1,49,99}%),LOOKUP(MOD(((10.78/0.77)), 1)+0.001, {0,25}%, {-1,99}%)))
after closer inspection I have discovered that in excel (at least mine) "=MOD(14,1)+0.001" =0.001 and "=MOD(10.78/(1-0.23),1)+0.001" =1.001 which is confusing since 10.78/(1-0.23)=14
I must be missing something disgustingly obvious
thanks for any help
jeff
Bookmarks