There is a small flaw, as the last bit may not exceed 255 so perhaps add =min(255,SPK formula)