Text Functions

This section contains descriptions of the Text functions.

このコマンドの見つけ方

挿入 → 関数 → 分類項目 文字列


REGEX

Matches and extracts or optionally replaces text using regular expressions.

WEBSERVICE

Get some web content from a URI.

FILTERXML

Apply a XPath expression to a XML document.

ENCODEURL

Returns a URL-encoded string.

EXACT

2 つのテキスト文字列を比較して、同じであれば TRUE を返します。この関数は、大文字と小文字を区別します。

Syntax

EXACT("テキスト 1"; "テキスト 2")

テキスト 1 は、比較する最初のテキストを指します。

テキスト 2 は、比較する 2 番目のテキストです。

Example

=EXACT("microsystems";"Microsystems") は、FALSE を返します。

ASC

ASC 関数は、ASCII およびカタカナ文字を全角から半角に変換します。テキスト文字列を返します。

See https://wiki.documentfoundation.org/Calc/Features/JIS_and_ASC_functions for a conversion table.

Syntax

ASC("テキスト")

テキスト は、変換される文字を含むテキストです。

JIS 関数も参照。

TEXT

Converts a value into text according to a given format.

Syntax

TEXT(Value; Format)

Value is the value (numerical or textual) to be converted.

書式 は、書式を定義するテキストです。小数位と桁の区切りはセル書式に設定されている言語に従います。

Example

=TEXT(12.34567;"###.##") は、テキスト 12.35 を返します。

=TEXT(12.34567;"000.00") は、テキスト 012.35 を返します

=TEXT("xyz";"=== @ ===") returns the text === xyz ===

tip

See also Number format codes: custom format codes defined by the user.


LENB

For double-byte character set (DBCS) languages, returns the number of bytes used to represent the characters in a text string.

tip

この関数は Collabora Office 4.2 以降で利用できます。


Syntax

LENB("テキスト")

テキスト は、その長さが決定されるテキストです。

Example

LENB("中") returns 2 (1 DBCS character consisting of 2 bytes).

LENB("中国") returns 4 (2 DBCS characters each consisting of 2 bytes).

LENB("office") returns 6 (6 non-DBCS characters each consisting of 1 byte).

=LENB("Good Afternoon") は、14 を返します。

=LENB(12345.67) は、8 を返します。

JIS

JIS 関数は、ASCII およびカタカナ文字を半角から全角に変換します。テキスト文字列を返します。

See https://wiki.documentfoundation.org/Calc/Features/JIS_and_ASC_functions for a conversion table.

Syntax

JIS("テキスト")

テキスト は、変換される文字を含むテキストです。

ASC 関数も参照。

MIDB

Returns a text string of a DBCS text. The parameters specify the starting position and the number of characters.

tip

この関数は Collabora Office 4.2 以降で利用できます。


Syntax

MIDB("Text"; Start; Number_bytes)

テキスト は、抽出する文字を含むテキストです。

Start is the position of the first character in the text to extract.

Number_bytes specifies the number of characters MIDB will return from text, in bytes.

Example

MIDB("中国";1;0) returns "" (0 bytes is always an empty string).

MIDB("中国";1;1) returns " " (1 byte is only half a DBCS character and therefore the result is a space character).

MIDB("中国";1;2) returns "中" (2 bytes constitute one complete DBCS character).

MIDB("中国";1;3) returns "中 " (3 bytes constitute one and a half DBCS character; the last byte results in a space character).

MIDB("中国";1;4) returns "中国" (4 bytes constitute two complete DBCS characters).

MIDB("中国";2;1) returns " " (byte position 2 is not at the beginning of a character in a DBCS string; 1 space character is returned).

MIDB("中国";2;2) returns " " (byte position 2 points to the last half of the first character in the DBCS string; the 2 bytes asked for therefore constitutes the last half of the first character and the first half of the second character in the string; 2 space characters are therefore returned).

MIDB("中国";2;3) returns " 国" (byte position 2 is not at the beginning of a character in a DBCS string; a space character is returned for byte position 2).

MIDB("中国";3;1) returns " " (byte position 3 is at the beginning of a character in a DBCS string, but 1 byte is only half a DBCS character and a space character is therefore returned instead).

MIDB("中国";3;2) returns "国" (byte position 3 is at the beginning of a character in a DBCS string, and 2 bytes constitute one DBCS character).

MIDB("office";2;3) returns "ffi" (byte position 2 is at the beginning of a character in a non-DBCS string, and 3 bytes of a non-DBCS string constitute 3 characters).

LEFTB

Returns the first characters of a DBCS text.

tip

この関数は Collabora Office 4.2 以降で利用できます。


Syntax

LEFTB("Text" [; Number_bytes])

Text is the text where the initial partial words are to be determined.

Number_bytes (optional) specifies the number of characters you want LEFTB to extract, based on bytes. If this parameter is not defined, one character is returned.

Example

LEFTB("中国";1) returns " " (1 byte is only half a DBCS character and a space character is returned instead).

LEFTB("中国";2) returns "中" (2 bytes constitute one complete DBCS character).

LEFTB("中国";3) returns "中 " (3 bytes constitute one DBCS character and a half; the last character returned is therefore a space character).

LEFTB("中国";4) returns "中国" (4 bytes constitute two complete DBCS characters).

LEFTB("office";3) returns "off" (3 non-DBCS characters each consisting of 1 byte).

RIGHTB

Returns the last character or characters of a text with double bytes characters sets (DBCS).

tip

この関数は Collabora Office 4.2 以降で利用できます。


Syntax

RIGHTB("Text" [; Number_bytes])

Text is the text of which the right part is to be determined.

Number_bytes (optional) specifies the number of characters you want RIGHTB to extract, based on bytes.

Example

RIGHTB("中国";1) returns " " (1 byte is only half a DBCS character and a space character is returned instead).

RIGHTB("中国";2) returns "国" (2 bytes constitute one complete DBCS character).

RIGHTB("中国";3) returns " 国" (3 bytes constitute one half DBCS character and one whole DBCS character; a space is returned for the first half).

RIGHTB("中国";4) returns "中国" (4 bytes constitute two complete DBCS characters).

RIGHTB("office";3) returns "ice" (3 non-DBCS characters each consisting of 1 byte).

FIND

Returns the position of a string of text within another string.You can also define where to begin the search. The search term can be a number or any string of characters. The search is case-sensitive.

Syntax

FIND("FindText"; "Text" [; Position])

検索テキスト は、検索されるテキストを指します。

テキスト は、検索を実行するテキストです。

位置 (オプション) は、検索を開始するテキスト内の位置です。

Example

=FIND(76;998877665544) は、6 を返します。

SEARCH

Returns the position of a text segment within a character string. You can set the start of the search as an option. The search text can be a number or any sequence of characters. The search is not case-sensitive. If the text is not found, returns error 519 (#VALUE).

The search supports wildcards or regular expressions. With regular expressions enabled, you can enter "all.*", for example to find the first location of "all" followed by any characters. If you want to search for a text that is also a regular expression, you must either precede every character with a "\" character, or enclose the text into \Q...\E. You can switch the automatic evaluation of wildcards or regular expression on and off in - Collabora Office Calc - Calculate.

warning

When using functions where one or more arguments are search criteria strings that represents a regular expression, the first attempt is to convert the string criteria to numbers. For example, ".0" will convert to 0.0 and so on. If successful, the match will not be a regular expression match but a numeric match. However, when switching to a locale where the decimal separator is not the dot makes the regular expression conversion work. To force the evaluation of the regular expression instead of a numeric expression, use some expression that can not be misread as numeric, such as ".[0]" or ".\0" or "(?i).0".


Syntax

SEARCH("FindText"; "Text" [; Position])

検索テキスト は、検索されるテキストです。

テキスト は、検索を実行するテキストです。

位置 (オプション) は、検索を開始するテキスト内の位置です。

Example

=SEARCH(54;998877665544) は、10 を返します。

DECIMAL

number system の文字を含むテキストを、指定された基数の正の整数に変換します。 基数は 2 から 36 の範囲とします。スペースとタブは無視されます。テキスト フィールドでは、大文字と小文字は区別されません。

基数が 16 の場合、先頭に付いている x、X、0x、または 0X、および末尾に付いている h または H は無視されます。基数が 2 の場合、末尾に付いている b または B は無視されます。記数法に属さないその他の文字はエラーになります。

Syntax

DECIMAL("テキスト"; 基数)

テキスト は、変換されるテキストです。A1 などの 16 進数とセル A1 を区別するために、たとえば "A1" または "FACE" のように数字を引用符で囲んでください。

Radix は、記数法の底を示します。これは、2 から 36 の任意の正の整数の場合があります。

Example

=DECIMAL("17";10) は、17 を返します。

=DECIMAL("FACE";16) は、64206 を返します。

=DECIMAL("0101";2) は、5 を返します。

T

この関数は、ターゲットテキストを返します。ターゲットがテキストでない場合は、空白の文字列を返します。

Syntax

T(値)

がテキスト文字列またはテキスト文字列を参照する場合、T はテキスト文字列を返します。そのほかの場合は、空白のテキスト文字列を返します。

Example

=T(12345) は、空の文字列を返します。

=T("12345") は、文字列 12345 を返します。

REPLACE

この関数は、文字列の一部を、別の文字列に置き換えます。文字列または数値の一部分を置換します。結果は常に文字列で返るため、数値は自動的に文字列としての数に変換されます。置換された数値を計算に使うには、戻り値を VALUE 関数で数値に変換する必要があります。

数値として認識されたくない (つまり、自動的にテキストに変換してもかまわない) 数字を含むテキストは引用符で囲みます。

Syntax

REPLACE("テキスト"; 位置; 長さ; "新しいテキスト")

文字列 は、その一部が置換されるテキストです。

位置 は、置換を開始するテキスト内の位置を指します。

長さ は、テキスト 内の置換される文字数です。

新しいテキスト は、テキストを置換するテキストを指します。

Example

=REPLACE("1234567";1;1;"444") は、"444234567" を返します。位置 1 の 1 文字は、完全な新しいテキストに置換されます。

LEN

この関数は、文字列の長さを返します。スペースも文字とみなされます。

Syntax

LEN("テキスト")

テキスト は、その長さが決定されるテキストです。

Example

=LEN("Good Afternoon") は、14 を返します。

=LEN(12345.67) は、8 を返します。

ROMAN

アラビア数字をローマ数字に変換します。変換元の数値は 0 から 3999 までの数値である必要があります。モードには 0 から 4 までの整数を指定できます。

Syntax

ROMAN(Number [; Mode])

数値 はローマ数字に変換される数値です。

書式 (オプション) は簡略度を示す 1 から 4 の値です。値が大きいほど簡単なローマ数字形式で戻り値が表示されます。

Example

=ROMAN (999) は、CMXCIX を返します。

=ROMAN(999;0) は、CMXCIX を返します。

=ROMAN (999;1) は、LMVLIV を返します。

=ROMAN(999;2) は、XMIX を返します。

=ROMAN(999;3) は、VMIV を返します。

=ROMAN(999;4) は、IM を返します。

UNICHAR

コード番号をユニコードキャラクターか文字に変換します。

Syntax

UNICHAR(number)

Example

=UNICHAR(169) はコピーライト記号である©を返します。

tip

See also the UNICODE() function.


UPPER

テキスト フィールドに含まれるアルファベット文字を、すべて大文字に変換します。

Syntax

UPPER("テキスト")

テキスト は、大文字に変換する小文字を指します。

Example

=UPPER("Good Morning") は、GOOD MORNING を返します。

LEFT

テキストの先頭の文字 (複数の文字も可) を返します。

Syntax

LEFT("Text" [; Number])

テキスト は、最初の部分ワードが決定されるテキストです。

文字数 (オプション) は、テキストの左 (先頭) から取り出す文字数です。このパラメーターが指定されていない場合、テキストの一番左 (先頭) の文字だけを返します。

Example

=LEFT("output";3) は、「out」を返します。

MID

テキストの文字列を返します。パラメーターは、開始位置と文字数を返します。

Syntax

MID("テキスト"; 開始; 数値)

テキスト は、抽出する文字を含むテキストです。

開始 は、抽出する文字の最初の文字の位置です。

数値 は、テキストの一部の文字数を指定します。

Example

=MID("office";2;2) は、ff を返します。

RIGHT

テキストの最後の文字 (複数の文字も可) を返します。

Syntax

RIGHT("Text" [; Number])

テキスト は、右部分が決定されるテキストです。

数値 (オプション) は、テキストの右部分の文字数です。

Example

=RIGHT("Sun";2) は、un を返します。

CODE

テキストや文字列の先頭文字のコードを返します。

Syntax

CODE("テキスト")

テキスト は、先頭文字のコード番号を調べるテキストです。

127 より大きいコードは、iso-8859-1、iso-8859-2、Windows-1252、Windows-1250 など、システムの文字マッピングに依存する可能性があり、移植性がないことがあります。

Example

=CODE("Hieronymus") は 72 を返します。=CODE("hieroglyphic") は 104 を返します。

note

ここで使用されるコードは ASCII コードではなく、現在使用しているコード表のコードです。


VALUE

テキスト文字列を数値に変換します。

Syntax

VALUE("テキスト")

テキスト は、数値に変換されるテキストです。

Example

=VALUE("4321") は、4321 を返します。

PROPER

テキスト文字列内にあるすべての単語の最初の文字を大文字にします。

Syntax

PROPER("テキスト")

テキスト は、変換されるテキストを指します。

Example

=PROPER("the document foundation") returns The Document Foundation.

ARABIC

ローマ数字を表す文字列をアラビア数字に変換します。0 から 3999 までの数が有効です。

Syntax

ARABIC("テキスト")

文字列 はローマ数字を表す文字列です。

Example

=ARABIC("MXIV") は、1014 を返します。

=ARABIC("MMII") は、2002 を返します。

REPT

指定された だけ文字列を繰り返します。

Syntax

REPT("テキスト"; 数値)

テキスト は、繰り返されるテキストです。

数値 は、繰り返し回数です。

戻り値の長さは最高255文字です。

Example

=REPT("Good morning";2) は、Good morningGood morning を返します。

FIXED

指定された小数位を持ち、任意で千単位の桁区切りが付いたテキストとして、数を返します。

Syntax

FIXED(Number; Decimals [; NoThousandsSeparators])

数値 は、書式設定される数値です。

小数位 は、表示する小数点以下の桁数です。

桁区切りの数 (オプション) は、桁区切りを使用するかどうかを決定します。パラメーターが 0 以外の数値の場合、桁区切りは無効になります。パラメーターが 0 に等しいか、まったくない場合、使用している 言語設定 の桁区切りが表示されます。

Example

=FIXED(1234567.89;3) は、テキスト文字列として 1,234,567.890 を返します。

=FIXED(1234567.89;3;1) は、テキスト文字列として 1234567.890 を返します。

DOLLAR

指定された小数点以下の桁数に丸められた通貨形式の金額に数値を変換します。通貨に変換する数字を「値」フィールドに入力します。オプションで「小数位」フィールドに小数点以下の桁数を入力することもできます。値が指定されていない場合、通貨形式のすべての数字は、小数位 2 桁で表示されます。

自分のシステム設定に通貨書式を設定します。

Syntax

DOLLAR(Value [; Decimals])

は、数値、数値を含むセルへの参照、または数値を返す数式です。

小数 は、小数点以下の桁数 (オプション) です。

Example

=DOLLAR(255) は、$255.00 を返します。

=DOLLAR(367.456;2) は、$367.46 を返します。言語設定 に対応する小数点を使用してください。

BASE

指定の基数で正の整数を記数法のテキストに変換します。0~9 の数字と A~Z のアルファベット文字が使用されます。

Syntax

BASE(Number; Radix [; MinimumLength])

数値 は、変換される正の整数です。

Radix は、記数法の底を示します。これは、2 から 36 の任意の正の整数の場合があります。

最小長さ (オプション) は、作成された文字列の最小長さを決定します。指定した最小長さより短い結果には、左にゼロが追加されます。

Example

=BASE(17;10;4) は、10 進数の 0017 を返します。

=BASE(17;2) は、2 進数の 10001 を返します。

=BASE(255;16;4) は、16 進数の 00FF を返します。

BAHTTEXT

数値を、タイの通貨名を含むタイ語のテキストに変換します。

Syntax

BAHTTEXT(数値)

数値 は任意の数字です。数値の整数部に「バーツ」が追加され、数値の小数部に「サタン」が追加されます。

Example

=BAHTTEXT(12.65) は、「12 バーツ 65 サタン」を意味するタイ文字の文字列を返します。

CLEAN

文字列から印刷されない文字を削除します。

Syntax

CLEAN("テキスト")

テキスト は、印刷できないすべての文字を削除するテキストを指します。

LOWER

文字列のアルファベット文字を、すべて小文字に変換します。

Syntax

LOWER("テキスト")

テキスト は、変換されるテキストを指します。

Example

=LOWER("Sun") は、sun を返します。

UNICODE

文字列の先頭文字のユニコードを返します。

Syntax

UNICODE("Text")

Example

=UNICODE("©") はユニコードでコピーライト記号を示す 169 を返します。

tip

See also the UNICHAR() function.


TRIM

文字列の間に空白文字を 1 文字分だけ残し、文字列から空白を削除します。

Syntax

TRIM("テキスト")

Text refers to text in which spaces are to be removed.

Example

=TRIM(" hello world ") returns hello world without leading and trailing spaces and with single space between words.

SUBSTITUTE

文字列内の古いテキストを新しいテキストで置換します。

Syntax

SUBSTITUTE("Text"; "SearchText"; "NewText" [; Occurrence])

テキスト は、テキストセグメントが交換されるテキストです。

検索テキスト は、指定回数、置換されるテキストセグメントです。

新しいテキスト は、テキストセグメントを置換するテキストです。

置換文字列 (オプション) は、検索テキストが置換される置換対象を示します。このパラメーターがない場合は、検索テキストが最初から最後まで置換されます。

Example

=SUBSTITUTE("123123123";"3";"abc") は、12abc12abc12abc を返します。

=SUBSTITUTE("123123123";"3";"abc";2) は、12312abc123 を返します。

CHAR

現在のロケールの文字コード表に従って、数値を文字に変換します。数値は 2 桁または 3 桁の整数の数値です。

127 より大きいコードは、iso-8859-1、iso-8859-2、Windows-1252、Windows-1250 など、システムの文字マッピングに依存する可能性があり、移植性がないことがあります。

Syntax

CHAR(数値)

数値 は、文字のコード値を表す 1 から 255 の数値です。

Example

=CHAR(100) は、文字 d を返します。

="abc" & CHAR(10) & "def" 文字列に改行文字を挿入します。

CONCATENATE

複数の文字列を 1 つのテキスト文字列に結合します。

Syntax

CONCATENATE(String 1 [; String 2 [; … [; String 255]]])

String 1[; String 2][; … ;[String 255]] are strings or references to cells containing strings.

Example

=CONCATENATE("Good ";"Morning ";"Mrs. ";"Doe") は、Good Morning Mrs. Doe を返します。

ご支援をお願いします!