Wulf Ratbane
Adventurer
CRGreathouse said:OK, let's start. I'm taking a fairly simple formula, as far as yours go, and making some kind of sense of it. This is the formula in cell D8.
=1+4*(LOG((2^(TRUNC(LOG(D7,2)))),2))+TRUNC((((D7/(2^(TRUNC(LOG(D7,2)))))-1)*4))
Let me break down what I was doing. I'm going to replace CR where it should be, and N where the number of combatants should go.
First part:
=1+4*(LOG((2^(TRUNC(LOG(CR,2)))),2))
What this does, actually, is find the lowest "base 2" starting point from the target CR. I'm not simply taking 2 to the power of log 2-- the TRUNC is important to get the lowest base 2 point. So, for example, if the CR is 18, the LOG2 is 4.169925; truncate this to an even 4, and raise back to the power of 2= 16. The starting off point is 16.
Now for the second part:
+TRUNC((((CR/(2^(TRUNC(LOG(CR,2)))))-1)*4))
What this unholy bastard is doing is finding the sub-divisions between one base-2 plateau and the next. Because double the CR = +4 EL, there are therefore 4 "steps" between each doubling, and furthermore each step is equidistant from the others.
So between CR16 and CR32, there are 4 steps: CR16-19, CR20-23, CR24-27, and CR28-31. What this formula does is find out how far from the next plateau the current CR is by simple division.
Working from the inside out, the LOG2,18 = 4.xx; driven back down to the next lower plateau with the trunc and ^2 operators = 16; 18/16 = 1.125; subtract 1 to get the fractional portion (.125), multiply x4 = .5, and truncated again = 0.
So what's that tell me? That CR18 is "0 steps" away from the CR16 plateau.
If you tried the same formula with CR20-23, the result = 1; with CR24-27, result 2; CR28-31, result 3.
(Also, in a fit of pique, I changed TRUNC to INT -- they work the same if you don't use the optional argument of TRUNC.)
In my mind I read TRUNC as "truncate," which is what the formula is doing. It's just an easier mnemonic device for me.
While this may make sense when making a formula from a chart, there's no reason to come up with a formula that rigidly follows the space constraints on the chart.
I didn't see much value in a spreadsheet that returned different values than UK's pen-and-paper system-- I'd just carry on using the pen and paper version and to hell with the spreadsheet.

Obvious simplification then follows.
=4*(Int(LOG(D7,2)))+1
This is much better. Of course, we can go one step beyond -- there's no reason to round until the end:
=Int(4*LOG(D7,2))+1
Well you know that's not true... order of operations and all that... There's a difference between 4*(INT(2.25)) and INT (4*2.25).
Wulf