表計算ドキュメントの関数

ここでは、表計算ドキュメント の関数について、例をあげながら説明します。

このコマンドの見つけ方

挿入 → 関数 → カテゴリー 表計算


ERROR.TYPE

Returns a number representing a specific Error type, or the error value #N/A, if there is no error.

ADDRESS

数値で指定された行番号と列番号から、セルのアドレス (参照) をテキストとして返します。アドレスの解釈は、絶対アドレス ($A$1)、相対アドレス (A1)、混在形式 (A$1 や $A1) のいずれにするかを指定できます。また、シート名も指定できます。

相互運用性のため、ADDRESS 関数 と INDIRECT 関数は、通常使われる A1 指定と、代替の R1C1 アドレス指定、どちらの形式のパラメーターもサポートします。

ADDRESS 関数では、オプションのシート名パラメータを第 5 パラメーターの位置に移動し、そのパラメーターは第 4 パラメーターとして挿入されます。

INDIRECT 関数では、そのパラメーターは、第 2 パラメータとして追加されます。

どちらの関数も、もし引数が値 0 で挿入される場合、R1C1 指定が使用されます。引数が与えられていない、または 0 以外の値の場合、A1 指定が使用されます。

R1C1 指定の場合、ADDRESS 関数はシート名の区切り子として感嘆符 '!' を使用したアドレスの文字列を返し、INDIRECT 関数は感嘆符をシート名の区切り子として期待します。どちらの関数も A1 指定の場合、まだピリオド '.' でのシート名の区切り子を使用しています。

When opening documents from ODF 1.0/1.1 format, the ADDRESS functions that show a sheet name as the fourth parameter will shift that sheet name to become the fifth parameter. A new fourth parameter with the value 1 will be inserted.

ODF 1.0/1.1 形式で保存するとき、ADDRESS 関数が第 4 パラメーターを持っていたら、そのパラメーターは削除されます。

note

もし ADDRESS 関数の新しい第 4 パラメーターが値 0 で使用されていたら、その表計算ドキュメントは古い ODF 1.0/1.1 形式で保存しないでください。


note

INDIRECT 関数は ODF 1.0/1.1 形式への変換なしで保存されます。もし第 2 パラメーターがある場合、古いバージョンの Calc はこの関数についてエラーを返します。


Syntax

ADDRESS(Row; Column [; Abs [; A1 [; "Sheet"]]])

は、セル参照の行番号を表します

は、セル参照の列番号 (文字でなく数字) を返します。

Abs は、参照のタイプを決定します:

1: 絶対参照 ($A$1)

2: 行が絶対参照、列が相対参照 (A$1)

3: 行が相対参照、列が絶対参照 ($A1)

4: 相対参照 (A1)

A1(オプション) 0 にセットすると、R1C1 指定が使用されます。このパラメーターがない、または 0 以外の値にセットされると A1 指定が使用されます。

シート は、シートの名前を表します。ダブルクオーテーションで囲んでください。

例:

=ADDRESS(1;1;2;;"Sheet2") は、Sheet2.A$1 を返します。

If the formula above is in cell B2 of current sheet, and the cell A1 in sheet 2 contains the value -6, you can refer indirectly to the referenced cell using a function in B2 by entering =ABS(INDIRECT(B2)). The result is the absolute value of the cell reference specified in B2, which in this case is 6.

AREAS

参照内の範囲の個数を返します。範囲には、連続するセルからなる範囲だけでなく、1 つのセルからなる範囲もあります。

この関数は1つの引数を受け取ります。複数の範囲を与える場合は追加の括弧で囲まなければなりません。複数の範囲を与えるには (;) を使用します。しかしこれは、自動的に ~(チルダ) に変換されます。チルダは範囲を加えるのに使用されます。

Syntax

AREAS(参照)

参照は、セルやセル範囲の参照です。

Example

範囲が 3 つのセルおよび (または) 範囲なので =AREAS((A1:B3;F2;G1)) は、 3 を返します。入力した後は =AREAS((A1:B3~F2~G1)) に変換されます。

「データ」 → 「範囲の指定」 で「All」という名前の範囲を定義している場合、=AREAS(All) は 1 を返します。

CHOOSE

最大 30 個からなる値のリストから 1 つ返すためにインデックスを使用します。

Syntax

CHOOSE(Index; Value 1 [; Value 2 [; ... [; Value 30]]])

インデックス は、1 から 30 までのどの値をリストから取り出すのかを指定する、参照または数値です。

Value 1, Value 2, ..., Value 30 is the list of values entered as a reference to a cell or as individual values.

Example

たとえば、=CHOOSE(A1;B1;B2;B3;"Today";"Yesterday";"Tomorrow") は、A1 = 2 の場合はセル B2 の内容を返します。A1 = 4 の場合は、テキスト「Today」を返します。

COLUMN

セル参照の列番号を返します。参照が単一のセルである場合、そのセルの列番号を返します。参照がセル範囲である場合、各セルの列番号からなる 1 行の行列を返します。この場合、数式は行列式として入力されている必要があります。参照がセル範囲であるが、数式が行列式として入力されていない場合、COLUMN 関数はセル範囲にある最初のセルの列番号だけを返します。

Syntax

COLUMN([Reference])

参照 は、セルもしくは最初の列番号が見つかったセル範囲の参照です。

参照を指定しない場合は、数式が入力されているセルの列番号が返ります。LibreOffice Calc は自動的に現在のセルの参照を指定します。

Example

=COLUMN(A1) は 1 に等しいです。列 A は、表の 1 番目の列です。

=COLUMN(C3:E3) は、3 に等しいです。列 C は、表の 3 番目の列です。

列 D は表の 4 番目の列で、COLUMN 関数は行列式として使用されないので、=COLUMN(D3:G10) は 4 を返します。この場合、行列の最初の値が常に結果として使用されます。

参照は列 B だけを表の第 2 列として持つので、{=COLUMN(B2:B7)}=COLUMN(B2:B7) は 2 を返します。単一列の範囲の列番号は 1 つだけなので、数式が行列式として使用されているかどうかで違いはありません。

数式が列 C に入力された場合、=COLUMN() は 3 を返します。

「Rabbit」が名前の付けられた範囲 (C1:D3) である場合、{=COLUMN(Rabbit)} は単一行行列 (3, 4) を返します。

COLUMNS

指定した範囲にある列の数を返します。

Syntax

COLUMNS(行列)

行列 は、列の合計を求めるセル範囲への参照です。この引数は、単一セルとすることもできます。

Example

セルは 1 列だけを含むので、=COLUMNS(B5) は 1 を返します。

=COLUMNS(A1:C5) は、3 に等しいです。この参照は、3 列を含みます。

Rabbit が名前の付いた範囲 (C1:D3) の場合、=COLUMNS(Rabbit) は 2 を返します。

DDE

DDEリンクの結果を返します。リンク先の範囲の内容が変わると、戻り値も変わります。更新されたリンクを表示するには、表計算ドキュメントを更新するか、編集 → リンク を選択する必要があります。クロスプラットフォームリンク(たとえば、Windowsマシンで動作しているLibreOfficeインストールからLinuxマシン上で作成されたドキュメントへのリンク)を行なってはいけません。

Syntax

DDE("Server"; "File"; "Range" [; Mode])

Server is the name of a server application. LibreOffice applications have the server name "soffice".

ファイル は、絶対パスによるファイル名です。

範囲 は、データを取り出す範囲です。

モード(オプション)は、DDEサーバーのデータがどのように数値に変換されるかを操作します

モード

効果

0 または指定なし

セルスタイル「標準」の数の書式

1

データは常に、英語 (米国) の標準書式で解釈されます。

2

データは文字列として受け取られ、数値には変換されません。


Example

=DDE("soffice";"c:\office\document\data1.ods";"sheet1.A1") reads the contents of cell A1 in sheet1 of the LibreOffice Calc spreadsheet data1.ods.

=DDE("soffice";"c:\office\document\motto.odt";"Today's motto") returns a motto in the cell containing this formula. First, you must enter a line in the motto.odt document containing the motto text and define it as the first line of a section named Today's Motto (in LibreOffice Writer under Insert - Section). If the motto is modified (and saved) in the LibreOffice Writer document, the motto is updated in all LibreOffice Calc cells in which this DDE link is defined.

ERRORTYPE

この関数は、ほかのセルで発生したエラー値の番号を返します。この番号を使うと、独自のエラーテキストを表示させることなどが可能になります。

If an error occurs, the function returns a logical or numerical value.

note

クリックしたセルに問題があると、LibreOffice からの定義済みエラーコードがステータスバーに表示されます。


Syntax

ERRORTYPE(参照)

参照 は、エラーが発生したセルのアドレスを含んでいます。

Example

セル A1 が Err:518 を表示する場合、関数 =ERRORTYPE(A1) は数字 518 を返します。

GETPIVOTDATA

GETPIVOTDATA 関数は、ピボットテーブルからの結果の値を返します。この値はフィールド名と項目名を使用して解決されるため、ピボットテーブルのレイアウトが変わっても有効です。

Syntax

2 種類の構文定義を使用できます。

GETPIVOTDATA(TargetField; pivot table[; Field 1; Item 1][; ... [Field 126; Item 126]])

or

GETPIVOTDATA(ピボットテーブル; 制約)

2 番目の構文は、正確に 2 つのパラメータが設定され、そのうちの最初のパラメーターがセルまたはセル範囲の参照であることを前提としています。1 番目の構文はその他のすべての場合を前提としています。関数ウィザードでは、1 番目の構文が表示されます。

First Syntax

ターゲットフィールド は、ピボットテーブルのデータフィールドを指定する文字列です。この文字列はソース列の名前、表に示されているとおりのデータフィールド名(例えば"Sum - Sales")の場合があります。

ピボットテーブル は、ピボットテーブル表内に置かれるか、ピボットテーブル表を含むセルまたはセル範囲への参照です。セル範囲に複数のピボットテーブル表が含まれる場合、最後に作成された表が使用されます。

フィールド名/項目名 のペアが指定されていない場合、総計が返されます。それ以外の場合は、各ペアが結果によって満たす必要のある制約を追加します。フィールド名 は、ピボットテーブルからのフィールドの名前です。項目名 は、そのフィールドからの項目の名前です。

ピボットテーブルにすべての制約を満たす 1 つの結果値、またはすべての一致する値をまとめた小計の結果しか含まれない場合、その結果が返されます。一致する結果がない場合や、結果の一部の結果があるだけで結果の小計がない場合、エラーが返されます。これらの条件は、ピボットテーブルに含まれる結果に適用されます。

ソースデータにピボットテーブルの設定によって非表示にされた項目が含まれる場合、それらの項目は無視されます。フィールド/項目ペアの順序は重要ではありません。フィールド名と項目名は大文字と小文字が区別されません。

If no constraint for a filter is given, the field's selected value is implicitly used. If a constraint for a filter is given, it must match the field's selected value, or an error is returned. Filters are the fields at the top left of a pivot table, populated using the "Filters" area of the pivot table layout dialog. From each filter, an item (value) can be selected, which means only that item is included in the calculation.

「auto」関数を使用する場合にだけ、ピボットテーブルからの小計値が使用されます (制約で指定されている場合は除きます。下の 2 番目の構文 を参照してください)。

Second Syntax

ピボットテーブル は、1 番目の構文での意味と同じ意味です。

制約 は、スペースで区切られたリストです。 項目を引用できます(シングルクオーテーション)。 別のセルから文字列を参照するのでなければ、文字列全体を引用符(ダブルクオーテーション)で囲む必要があります。

項目の 1 つをデータフィールド名にすることができます。ピボットテーブルにデータフィールドが 1 つしか含まれない場合、データフィールド名を省略することができます。それ以外の場合は、データフィールド名が必要です。

ほかの項目はそれぞれ Field[Item] (文字 [ および ] を指定して) の形式で、または、項目名がピボットテーブル内で使われるすべてのフィールド内で一意である場合は Item のみで制約を指定します。

関数名は Field[Item;Function] 形式で追加できます。これにより、その関数を使用する小計値だけに一致するような制限が課せられます。使用できる関数名は、Sum、Count、Average、Max、Min、Product、Count (数値のみ)、StDev (標本)、StDevP (母集団)、Var (標本)、および VarP (母集団) で、大文字と小文字は区別されません。

HLOOKUP

選択した範囲の下にあるセルの値と参照を検索します。この関数は、指定された範囲の最初の列に、指定した値が含まれているかどうかをチェックします。そして、範囲の同じ列にある、インデックス で指定された行の値を返します。

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 - LibreOffice 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

HLOOKUP(Lookup; Array; Index [; SortedRangeLookup])

For an explanation on the parameters, see: VLOOKUP (columns and rows are exchanged)

空白のセルの処理

Example

Suppose we have built a small database table occupying the cell range A1:DO4 and containing basic information about 118 chemical elements. The first column contains the row headings “Element”, “Symbol”, “Atomic Number”, and “Relative Atomic Mass”. Subsequent columns contain the relevant information for each of the elements, ordered left to right by atomic number. For example, cells B1:B4 contain “Hydrogen”, “H”, “1” and “1.008”, while cells DO1:DO4 contain “Oganesson”, “Og”, “118”, and “294”.

A

B

C

D

...

DO

1

Element

Hydrogen

Helium

Lithium

...

Oganesson

2

Symbol

H

He

Li

...

Og

3

Atomic Number

1

2

3

...

118

4

Relative Atomic Mass

1.008

4.0026

6.94

...

294


=HLOOKUP("Lead"; $A$1:$DO$4; 2; 0) returns “Pb”, the symbol for lead.

=HLOOKUP("Gold"; $A$1:$DO$4; 3; 0) returns 79, the atomic number for gold.

=HLOOKUP("Carbon"; $A$1:$DO$4; 4; 0) returns 12.011, the relative atomic mass of carbon.

HYPERLINK

HYPERLINK 関数を含むセルをクリックすると、ハイパーリンクが開きます。

オプションの セルテキスト パラメーターを使用すると、数式は URL を決め、テキストまたは数字を表示します。

tip

ハイパーリンクを含むセルをキーボードから開くには、セルを選択して F2 キーを押して編集モードに入り、カーソルをハイパーリンクに置いて (Shift) + (F10) キーを押し、ハイパーリンクを開く を選択します。


Syntax

HYPERLINK("URL" [; "CellText"])

URL は、リンクターゲットを指定します。オプションの セルテキスト パラメーターは、セルに表示され、関数の結果として返される、テキスト、または数値です。セルテキストパラメーターが指定されていない場合は、URL がセルテキストに表示され、関数の結果として返されます。

空のセルと行列要素のついては、値 0 が返されます。

Example

=HYPERLINK("http://www.example.org") displays the text "http://www.example.org" in the cell and executes the hyperlink http://www.example.org when clicked.

=HYPERLINK("http://www.example.org";"Click here") displays the text "Click here" in the cell and executes the hyperlink http://www.example.org when clicked.

=HYPERLINK("http://www.example.org";12345) displays the number 12345 and executes the hyperlink http://www.example.org when clicked.

=HYPERLINK($B4) where cell B4 contains http://www.example.org. The function adds http://www.example.org to the URL of the hyperlink cell and returns the same text which is used as formula result.

=HYPERLINK("http://www.";"Click ") & "example.org" displays the text Click example.org in the cell and executes the hyperlink http://www.example.org when clicked.

=HYPERLINK("#Sheet1.A1";"Go to top") displays the text Go to top and jumps to cell Sheet1.A1 in this document.

=HYPERLINK("file:///C:/writer.odt#Specification";"Go to Writer bookmark") displays the text "Go to Writer bookmark", loads the specified text document and jumps to bookmark "Specification".

=HYPERLINK("file:///C:/Documents/";"Open Documents folder") displays the text "Open Documents folder" and shows the folder contents using the standard file manager in your operating system.

INDEX

INDEX は、行および列番号またはオプションの範囲インデックスで指定された部分範囲を返します。INDEX は、コンテキストによって参照または内容を返します。

Syntax

INDEX(Reference [; Row [; Column [; Range]]])

参照 は、直接または範囲名を指定して入力される参照です。参照が複数の範囲で構成される場合は、参照または範囲名をかっこで囲みます。

(オプション) は、値を返す参照範囲の行インデックスを表します。ゼロ (具体的な行がない) の場合は、参照されているすべての行が返されます。

(オプション) は、値を返す参照範囲の列インデックスを表します。ゼロ (具体的な列がない) の場合は、参照されているすべての列が返されます。

範囲 (オプション) は、多重範囲を参照する場合の部分範囲のインデックスを表します。

Example

=INDEX(Prices;4;1) は、データ → 定義取得価額 として定義されているデータベース範囲の 4 行 1 列から値を返します。

=INDEX(SumX;4;1) returns the value from the range SumX in row 4 and column 1 as defined in Sheet - Named Ranges and Expressions - Define.

=INDEX(A1:B6;1) は、A1:B6 の最初の行への参照を返します。

=INDEX(A1:B6;0;1) は、A1:B6 の最初の列への参照を返します。

=INDEX((multi);4;1) indicates the value contained in row 4 and column 1 of the (multiple) range, which you named under Sheet - Named Ranges and Expressions - Define as multi. The multiple range may consist of several rectangular ranges, each with a row 4 and column 1. If you now want to call the second block of this multiple range enter the number 2 as the range parameter.

=INDEX(A1:B6;1;1) は、A1 から B6 の範囲の左上にある値を示します。

=INDEX((multi);0;0;2) は、複合範囲の 2 番目の範囲への参照を返します。

INDIRECT

文字列が指定する 参照 を返します。この関数には、セル範囲を指定することもできます。

This function is always recalculated whenever a recalculation occurs.

相互運用性のため、ADDRESS 関数 と INDIRECT 関数は、通常使われる A1 指定と、代替の R1C1 アドレス指定、どちらの形式のパラメーターもサポートします。

ADDRESS 関数では、オプションのシート名パラメータを第 5 パラメーターの位置に移動し、そのパラメーターは第 4 パラメーターとして挿入されます。

INDIRECT 関数では、そのパラメーターは、第 2 パラメータとして追加されます。

どちらの関数も、もし引数が値 0 で挿入される場合、R1C1 指定が使用されます。引数が与えられていない、または 0 以外の値の場合、A1 指定が使用されます。

R1C1 指定の場合、ADDRESS 関数はシート名の区切り子として感嘆符 '!' を使用したアドレスの文字列を返し、INDIRECT 関数は感嘆符をシート名の区切り子として期待します。どちらの関数も A1 指定の場合、まだピリオド '.' でのシート名の区切り子を使用しています。

When opening documents from ODF 1.0/1.1 format, the ADDRESS functions that show a sheet name as the fourth parameter will shift that sheet name to become the fifth parameter. A new fourth parameter with the value 1 will be inserted.

ODF 1.0/1.1 形式で保存するとき、ADDRESS 関数が第 4 パラメーターを持っていたら、そのパラメーターは削除されます。

note

もし ADDRESS 関数の新しい第 4 パラメーターが値 0 で使用されていたら、その表計算ドキュメントは古い ODF 1.0/1.1 形式で保存しないでください。


note

INDIRECT 関数は ODF 1.0/1.1 形式への変換なしで保存されます。もし第 2 パラメーターがある場合、古いバージョンの Calc はこの関数についてエラーを返します。


Syntax

INDIRECT(Ref [; A1])

参照 は、内容を返すセルまたは領域の参照をテキスト形式で表します。

A1(オプション) 0 にセットすると、R1C1 指定が使用されます。このパラメーターがない、または 0 以外の値にセットされると A1 指定が使用されます。

note

If you open an Excel spreadsheet that uses indirect addresses calculated from string functions, the sheet addresses will not be translated automatically. For example, the Excel address in INDIRECT("[filename]sheetname!"&B1) is not converted into the Calc address in INDIRECT("filename#sheetname."&B1).


Example

A1 が C108 を参照として含み、セル C108 が値 100 を含む場合、=INDIRECT(A1) は 100 になります。

=SUM(INDIRECT("a1:" & ADDRESS(1;3))) は、A1 から行 1 と列 3 によって定義されているアドレスのセルまでの範囲のセルを合計します。つまり、範囲 A1:C1 が合計されます。

LOOKUP

Returns the contents of a cell either from a one-row or one-column range. Optionally, the assigned value (of the same index) is returned in a different column and row. As opposed to VLOOKUP and HLOOKUP, search and result vector may be at different positions; they do not have to be adjacent. Additionally, the search vector for the LOOKUP must be sorted ascending, otherwise the search will not return any usable results.

note

LOOKUP で検索基準を見つけることができない場合、検索基準以下の検索範囲で最大の値と一致します。


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 - LibreOffice 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

LOOKUP(Lookup; SearchVector [; ResultVector])

Lookup is the value of any type to be looked for; entered either directly or as a reference.

検索範囲 は、検索される単一行または単一列の範囲です。

結果範囲 は、関数の結果が取得される別の単一行または単一列の範囲です。結果は、検索範囲で検出されたインスタンスと同じインデックスを持つ結果範囲のセルです。

空白のセルの処理

Example

=LOOKUP(A1;D1:D100;F1:F100) は、範囲 D1:D100 で A1 で入力した数値に対応するセルを検索します。検索された例について、たとえば、この範囲の 12 番目のセル、というふうにインデックスが決定されます。次にその 12 番目のセルの内容が、関数の値 (一次元配列) として返されます。

MATCH

指定された値に一致する項目の範囲内における相対的な位置を返します。この関数は検索範囲で見つかった値の位置を数値で返します。

Syntax

MATCH(Search; LookupArray [; Type])

Search is the value which is to be searched for in the single-row or single-column array.

ルックアップ行列 は、検索される参照です。ルックアップ行列は、単一行、単一列、または単一行や単一列の一部の場合があります。

には、1、0、または -1 の値を指定できます。型が 1 の場合 (または、オプションのパラメーターを指定しない場合)、検索範囲の最初の列が昇順で並べ替えられていると仮定されます。型が -1 の場合、その列が降順で並べ替えられていると仮定されます。これは Microsoft Excel の同じ関数と対応します。

If Type = 0, only exact matches are found. If the search criterion is found more than once, the function returns the index of the first matching value. Only if Type = 0 can you search for regular expressions (if enabled in calculation options) or wildcards (if enabled in calculation options).

タイプ = 1 または 3 番目のパラメータがない場合、検索条件以下の最後の値のインデックスが返されます。これは、検索行列が並べ替えられていない場合にも当てはまります。タイプ = -1 の場合は、検索条件以上の最初の値が返されます。

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 - LibreOffice 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".


Example

=MATCH(200;D1:D100) は、列 D で並べ替えられる範囲 D1:D100 で値 200 を検索します。この値に到達するとすぐに、この値が見つかった行の番号が返されます。列の検索中により大きい値が見つかった場合は、前の行の番号が返されます。

OFFSET

基準セルから指定の行数と列数を移動した位置にあるセルの値を返します。

This function is always recalculated whenever a recalculation occurs.

Syntax

OFFSET(Reference; Rows; Columns [; Height [; Width]])

参照 は、関数が新しい参照を検索する参照元です。

は、参照を上 (負の値) または下に修正した行の番号です。

は、参照を上 (負の値) または下に修正した行の番号です。

高さ (オプション) は、新しい参照位置が開始される範囲の垂直方向の高さです。

(オプション) は、新しい参照位置が開始される範囲の水平方向の幅です。

引数 は、ゼロまたは負の開始行または列にならないようにします。

引数 高さ は、ゼロまたは負の行または列数にならないようにします。

In the LibreOffice Calc functions, parameters marked as "optional" can be left out only when no parameter follows. For example, in a function with four parameters, where the last two parameters are marked as "optional", you can leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter 3 alone.

Example

=OFFSET(A1;2;2) は、セル C3 の値を返します。これは、A1 から 2 行と 2 列下に移動したからです。C3 が値 100 を含む場合、この関数は値 100 を返します。

=OFFSET(B2:C3;1;1) は、B2:C3 から 1 行 1 列右下に移動した C3:D4 への参照を返します。

=OFFSET(B2:C3;-1;-1) は、B2:C3 から 1 行 1 列左に移動した A1:B2 への参照を返します。

=OFFSET(B2:C3;0;0;3;4) は、B2:C3 を3行4列にリサイズした B2:E4 への参照を返します。

=OFFSET(B2:C3;1;0;3;4) は、B2:C3 を 3 行 4 列 のサイズに変更し、1 行下に移動した B3:E5 への参照を返します。

=SUM(OFFSET(A1;2;2;5;6)) はセル C3 から始まる範囲の合計を決定し、高さ 5 行、幅 6 列です (範囲 = C3:H7)。

note

If Width or Height are given, the OFFSET function returns a cell range reference. If Reference is a single cell reference and both Width and Height are omitted, a single cell reference is returned.


ROW

セル参照の行番号を返します。参照が単一のセルの場合、そのセルの行番号を返します。参照がセル範囲の場合、各セルの行番号からなる 1 列の行列を返します。この場合、数式を行列式として入力する必要があります。参照がセル範囲であるが、数式を行列式として入力しない場合、ROW 関数はセル範囲にある最初のセルの行番号だけを返します。

Syntax

ROW([Reference])

範囲 は、セルか、範囲か、名前を付けた範囲です。

範囲を指定しない場合、数式を入力したセルの行番号が返ります。LibreOffice Calc は自動的に現在のセル参照を範囲に適用します。

Example

参照は表の 3 行目を参照するので、=ROW(B3) は 3 を返します。

指定された参照は行 5 から 8 を含むので、{=ROW(D5:D8)} は単一列行列 (5, 6, 7, 8) を返します。

ROW 関数は行列式として使用されず、参照の最初の行の数だけが返されるので、=ROW(D5:D8) は 5 を返します。

この参照は表の第 1 行に行 1 だけを含むので、{=ROW(A1:E1)}=ROW(A1:E1) は両方 1 を返します。単一行の範囲は 1 つの行番号だけを持つので、数式が行列式として使用されているかどうかで違いはありません。

数式が行 3 に入力された場合、=ROW() は 3 を返します。

「Rabbit」が名前の付けられた範囲 (C1:D3) である場合、{=ROW(Rabbit)} は単一列行列 (1, 2, 3) を返します。

ROWS

範囲内の行数を返します。

Syntax

ROWS(行列)

行列 は、列の合計を決定する参照または名前付きの範囲です。

Example

セルは 1 行だけを含むので、=Rows(B5) は 1 を返します。

=ROWS(A10:B12) は、3 を返します。

「Rabbit」が名前の付いた範囲 (C1:D3) の場合、=ROWS(Rabbit) は 3 を返します。

SHEET

Returns the sheet number of either a reference or a string representing a sheet name. If you do not enter any parameters, the result is the sheet number of the spreadsheet containing the formula.

Syntax

SHEET([Reference])

参照 (オプション) は、セル、範囲、またはシート名への参照です。

Example

=SHEET(Sheet2.A1) returns 2 if Sheet2 is the second sheet in the spreadsheet document.

=SHEET("Sheet3") returns 3 if Sheet3 is the third sheet in the spreadsheet document.

SHEETS

参照のシート数を返します。パラメーターを指定しない場合は、現在のドキュメントのシート数を返します。

Syntax

SHEETS([Reference])

参照 はシートまたは範囲への参照です。このパラメーターはオプションです。

Example

Sheet1、Sheet2、Sheet3 が示されている順序で存在する場合、=SHEETS(Sheet1.A1:Sheet3.G12) は 3 を返します。

STYLE

Applies a style to the cell containing the formula. After a set amount of time, another style can be applied. This function always returns the value 0, allowing you to add it to another function without changing the value. Together with the CURRENT function you can apply a color to a cell depending on the value. For example: =...+STYLE(IF(CURRENT()>3;"red";"green")) applies the style "red" to the cell if the value is greater than 3, otherwise the style "green" is applied. Both cell formats, "red" and "green" have to be defined beforehand.

Syntax

STYLE("Style" [; Time [; "Style2"]])

スタイル はセルに割り当てるセルスタイルの名前です。スタイル名は引用符で囲む必要があります。

時間 (オプション) に秒数を指定すると、指定の秒数後にスタイルが変更されます。

スタイル 2 は、一定の時間が過ぎるとセルに割り当てられるセルスタイルのオプション名です。このパラメーターがない場合は、「デフォルト」が想定されます。

In the LibreOffice Calc functions, parameters marked as "optional" can be left out only when no parameter follows. For example, in a function with four parameters, where the last two parameters are marked as "optional", you can leave out parameter 4 or parameters 3 and 4, but you cannot leave out parameter 3 alone.

Example

=STYLE("Invisible";60;"Default") は、ドキュメントが再計算または読み込み後 60 秒間、透明な形式にセルを書式設定し、その後、デフォルト書式を割り当てます。両方のセル書式を事前に定義する必要があります。

Since STYLE() has a numeric return value of zero, this return value gets appended to a string. This can be avoided using T() as in the following example:

="Text"&T(STYLE("myStyle"))

別の例については、CURRENT() を参照してください。

VLOOKUP

Vertical search with reference to adjacent cells to the right. This function checks if a specific value is contained in the first column of an array. The function then returns the value in the same row of the column named by Index. If the Sorted parameter is omitted or set to TRUE or one, it is assumed that the data is sorted in ascending order. In this case, if the exact Lookup is not found, the last value that is smaller than the criterion will be returned. If Sorted is set to FALSE or zero, an exact match must be found, otherwise the error Error: Value Not Available will be the result. Thus with a value of zero the data does not need to be sorted in ascending order.

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 - LibreOffice 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

=VLOOKUP(Lookup; Array; Index [; SortedRangeLookup])

Lookup is the value of any type looked for in the first column of the array.

Array is the reference, which is to comprise at least as many columns as the number passed in Index argument.

インデックス は、返される値を含む行列の列の番号です。最初の列の番号は、1 です。

SortedRangeLookup is an optional parameter that indicates whether the first column in the array contains range boundaries instead of plain values. In this mode, the lookup returns the value in the row with first column having value equal to or less than Lookup. E.g., it could contain dates when some tax value had been changed, and so the values represent starting dates of a period when a specific tax value was effective. Thus, searching for a date that is absent in the first array column, but falls between some existing boundary dates, would give the lower of them, allowing to find out the data being effective to the searched date. Enter the Boolean value FALSE or zero if the first column is not a range boundary list. When this parameter is TRUE or not given, the first column in the array must be sorted in ascending order. Sorted columns can be searched much faster and the function always returns a value, even if the search value was not matched exactly, if it is greater than the lowest value of the sorted list. In unsorted lists, the search value must be matched exactly. Otherwise the function will return #N/A with message: Error: Value Not Available.

空白のセルの処理

Example

You want to enter the number of a dish on the menu in cell A1, and the name of the dish is to appear as text in the neighboring cell (B1) immediately. The Number to Name assignment is contained in the D1:E100 array. D1 contains 100, E1 contains the name Vegetable Soup, and so forth, for 100 menu items. The numbers in column D are sorted in ascending order; thus, the optional Sorted parameter is not necessary.

B1 に次の数式を入力します。

=VLOOKUP(A1;D1:E100;2)

A1 に番号を入力すると、B1 には 列D に入力されている該当番号の料理名が表示されます。存在しない番号を指定すると、その番号よりひとつ小さい番号の項目が表示されます。この表示が必要でない場合は、最後のパラメーターに FALSE を指定します。こうすると、存在しない番号が入力された場合にエラーメッセージが表示されます。

ご支援をお願いします!