(脱線)GoogleスプレッドシートでKとかMとか
// セルに =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();
}
(つづく
(脱線)GoogleスプレッドシートでKとかMとか
① スプレッドシートを開く
② [拡張機能]メニュー > [Apps Script]メニュー
③ 上記のコードを貼り付けて保存
④ シートに戻って、=KMGT(A1) などと入力
(おわり