Advanced-excel-functions-advanced-excel-statistical-text-function
高度なExcel統計-TEXT関数
説明
TEXT関数は、数値をテキストに変換し、特別な形式文字列を使用して表示形式を指定できるようにします。
この機能は、数字をより読みやすい形式で表示したい場合や、数字をテキストや記号と組み合わせたい場合に役立ちます。
構文
TEXT (value, format_text)
引数
Argument | Description | Required/Optional |
---|---|---|
value | A numeric value, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value. | Required |
format_text |
A numeric format as a text string enclosed in quotation marks, for example "m/d/yyyy" or ",#0.00". 以下のセクションでは、特定のフォーマットのガイドラインを示します。 |
Required |
数値形式のガイドライン
小数点以下の桁数と有効数字の表示-小数点を含む分数または数値をフォーマットするには、format_text引数に次の桁プレースホルダー、小数点、および桁区切り記号を含めます。
Sr.No | Placeholder & Description |
---|---|
1 |
0 (zero) 数値の桁数が形式のゼロよりも少ない場合、意味のないゼロを表示します。 |
2 |
# 0(ゼロ)と同じルールに従います。 ただし、入力した数値の小数点以下の桁数がフォーマットに#記号より少ない場合、Excelは余分なゼロを表示しません。 |
3 |
? 0(ゼロ)と同じルールに従います。 ただし、Excelでは、小数点の両側に意味のないゼロ用のスペースが追加されるため、列内で小数点が揃えられます。 |
4 |
数値の小数点を表示します。 |
- 3桁ごとの区切り記号を表示*-カンマを3桁ごとの区切り記号として表示したり、数値を1,000の倍数でスケールするには、数値形式に次の区切り記号を含めます。
Sr.No | Placeholder & Description |
---|---|
5 |
, (comma) 桁区切り記号を数字で表示します。 Excelは、形式に番号記号(#)またはゼロで囲まれたコンマが含まれている場合、コンマで数千を区切ります。 数字プレースホルダーに続くカンマは、数値を1,000倍にします。 |
日付と時刻の形式のガイドライン
日、月、年を表示-数値を日付形式(日、月、年など)として表示するには、format_text引数で次のコードを使用します。
m | Displays the month as a number without a leading zero. |
mm | Displays the month as a number with a leading zero when appropriate. |
mmm | Displays the month as an abbreviation (Jan to Dec). |
mmmm | Displays the month as a full name (January to December). |
mmmmm | Displays the month as a single letter (J to D). |
d | Displays the day as a number without a leading zero. |
dd | Displays the day as a number with a leading zero when appropriate. |
ddd | Displays the day as an abbreviation (Sun to Sat). |
dddd | Displays the day as a full name (Sunday to Saturday). |
yy | Displays the year as a two-digit number. |
yyyy | Displays the year as a four-digit number. |
時間、分、秒を表示-時間形式(時間、分、秒など)を表示するには、format_text引数で次のコードを使用します。
h | Displays the hour as a number without a leading zero. |
[h] | Displays elapsed time in hours. If you are working with a formula that returns a time in which the number of hours exceeds 24, use a number format that resembles [h]:mm:ss. |
hh | Displays the hour as a number with a leading zero when appropriate. If the format contains AM *or PM*, the hour is shown based on the 12-hour clock. Otherwise, the hour is shown based on the 24-hour clock. |
h | Displays the hour as a number without a leading zero. |
m |
Displays the minute as a number without a leading zero.
|
[m] | Displays elapsed time in minutes. If you are working with a formula that returns a time in which the number of minutes exceeds 60, use a number format that resembles [mm]:ss. |
mm |
Displays the minute as a number with a leading zero when appropriate.
|
s | Displays the second as a number without a leading zero. |
[s] | Displays elapsed time in seconds. If you are working with a formula that returns a time in which the number of seconds exceeds 60, use a number format that resembles [ss]. |
ss | Displays the second as a number with a leading zero when appropriate. If you want to display fractions of a second, use a number format that resembles *h:mm:ss.00 * |
AM/PM, am/pm, A/P, a/p | Displays the hour based on a 12-hour clock. Excel displays* AM, am, A, or a for times from midnight until noon and PM, pm, P, or p* for times from noon until midnight. |
通貨、割合、および科学表記形式のガイドライン
通貨記号を含める-数値の前にドル記号($)を付けるには、format_text引数の先頭にドル記号を入力します(たとえば、 "$#、## 0.00" )。 次の通貨記号のいずれかを数値形式で入力するには、NumLockキーを押し、数字キーパッドを使用して記号のANSIコードを入力します。
テンキーを使用する必要があります。キーボードの一番上の行にあるAltキーと数字キーを使用しても、ANSIコードは生成されません。
To enter | Use this key combination |
---|---|
¢ | ALT+0162 |
£ | ALT+0163 |
¥ | ALT+0165 |
€ | ALT+0128 |
パーセントを表示-100のパーセントとして数値を表示するには、format_text引数にパーセント記号(%)を含めます。
科学表記法を表示-科学(指数)形式で数値を表示するには、format_text引数で次の指数コードを使用します。
E (E-, E+, e-, e+) | Displays a number in scientific (exponential) format. Excel displays a number to the right of the "E" or "e" that corresponds to the number of places that the decimal point was moved. |
テキストを含め、間隔を追加するためのガイドライン
format_text引数に次の文字のいずれかを含めると、入力したとおりに表示されます。
$ | Dollar sign |
+ | Plus sign |
( | Left parenthesis |
: | Colon |
^ | Circumflex accent (caret) |
' | Apostrophe |
\{ | Left curly bracket |
< | Less-than sign |
= | Equal sign |
- | Minus sign |
/ | Slash mark |
) | Right parenthesis |
! | Exclamation point |
& | Ampersand |
~ | Tilde |
} | Right curly bracket |
> | Greater-than sign |
Space character |
format_text引数にアスタリスク(*)を含めることはできません
TEXT関数を使用すると、数値が書式設定されたテキストに変換され、結果を数値として計算できなくなります
ノート
- リボンの[ホーム]タブの[数値]グループのコマンドを使用して、数値を書式設定することもできます。 ただし、これらのコマンドは、セル全体が数値の場合にのみ機能します。 数値を書式設定して他のテキストと組み合わせる場合は、TEXT関数が最適なオプションです。
- format_text引数の前後から引用符を省略すると、TEXTは#NAME?を返します。 エラー値
適用範囲
Excel 2007、Excel 2010、Excel 2013、Excel 2016