Jochen, I've finally got something to call "close to working". If you have it handy could you be so kind to give the individual values of Sam and Max for 991 or 89. In other words... what is $s and $m in the following?

$a=$S - $M

My function and my scribble match, but they don't match the ini result.