The loop at the end, the 3rd parameter of asc(), two parentheses, starting with null placing the increment at the top saves us the endif,
results in 121 - 25 = 96

 Code:
Function a($)
  Dim $x, $y
  While $x <= Len($)
    $x=$x+1
    $y = Asc(SubStr($,$x))
    If $y>64
        $a=$a+$x*($y-64)
;    EndIf
;  Loop
EndFunction
_________________________