// セルに =KMGT(A1) などと入れて使う
function KMGT(input) {
if (typeof input !== 'number') return input;
if (input >= 1_000_000_000_000) return (input / 1_000_000_000_000).toFixed(3) + "T";
if (input >= 1_000_000_000) return (input / 1_000_000_000).toFixed(3) + "G";
if (input >= 1_000_000) return (input / 1_000_000).toFixed(3) + "M";
if (input >= 1_000) return (input / 1_000).toFixed(3) + "K";
return input.toString();
}
(つづく