Microsoft Excelでは、15桁以上の数字を入力すると、15桁目以降の数字がゼロに変わります。このため、クレジットカードIDなどの入力時に問題が発生します。原因は、Excelが浮動小数点数をIEEE 754規格に従って処理するためです。解決策として、数値の前にシングルクォーテーションを追加する方法や、セルをテキスト形式に設定する方法があります。テキスト形式のセルでは最大32,767文字まで入力可能です。問題が解決しない場合は、Microsoft Communityを参照してください。
Excelの数字に関する問題と解決策
症状
Microsoft Excelで15桁を超える数字をセルに入力すると、15桁目以降の数字がゼロに変更されてしまいます。例えば、以下の形式のクレジットカードID番号を入力した場合です:
-####-####-
この場合、Excelは最後の数字をゼロに変換します。
原因
ExcelはIEEE 754仕様に従って浮動小数点数を保存および計算します。したがって、Excelは数字の重要な桁数を15桁までしか保存せず、15桁目以降の数字をゼロに変更します。
回避策
1. 引用符を追加する
数字がゼロに変更されるのを防ぐためには、数字を入力する前に単一の引用符を入力します。
方法は次の通りです:
- 空のセルを選択し、単一の引用符(’)を入力します。
- 次に数字を入力すると、すべての桁がセルに表示されます。

2. セルをフォーマットする
影響を受けるすべてのセルに引用符を入力する手間を省くために、データを入力する前にセルをテキストとしてフォーマットすることができます。
手順:
- 影響を受けるすべてのセルを選択し、Ctrl+1を押してセルの書式設定ダイアログボックスを開きます。
- 数値タブで、カテゴリーリストからテキストを選択し、OKをクリックします。

追加情報
この問題は、セルが数値としてフォーマットされている場合にのみ発生し、入力された数字が15桁を超えるときに起こります。テキストとしてフォーマットされているセルでは、最大32,767文字まで入力可能で、Excelはワークシートに最大1,024文字を表示します。
カスタム数値フォーマットは主に数値に対して設計されているため、15桁を超える数字を保存するカスタム数値フォーマットを作成することはできません。たとえば、16桁のクレジットカードIDを数値として保存するために次のフォーマットを使用することはできません:
-####-####-
しかし、テキストとしてフォーマットされたセルに数字を入力すると、Excelはその数字をテキストとして保存するため、すべての文字がそのまま入力されます。
さらにサポートが必要ですか?Microsoft Communityにアクセスしてください。
————-
Last digits are changed to zeros when you type long numbers in cells of Excel – Microsoft 365 Apps
Source link
Symptoms
In Microsoft Excel, when you enter a number with more than 15 digits, Excel converts any digits beyond the fifteenth to zeros. For instance, if you enter a credit card number formatted as ####-####-####-####, the last digit will become zero.
Cause
This issue arises because Excel adheres to the IEEE 754 standard for storing floating-point numbers, which limits it to 15 significant digits. Therefore, any digits after the fifteenth position are replaced with zeros.
Workarounds
-
Add a Quotation Mark: To prevent the last digits from being changed, prefix the number with a single quotation mark (‘). For example, entering ‘1234-5678-9101-1121 keeps all digits intact.
-
Format Cells as Text: To avoid adding a quotation mark each time, you can format the affected cells as text before entering any data:
- Select the cells, press Ctrl+1 to open the Format Cells dialog box.
- Choose Text from the Number tab and click OK.
More Information
This behavior only occurs in cells formatted as numbers. Cells formatted as text can contain up to 32,767 characters, with 1,024 characters displayed on the worksheet. Custom number formats cannot store more than 15 digits. If entered into a text-formatted cell, all characters will remain visible since they are stored as text.
For further help, visit the Microsoft Community.