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

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

このコマンドの見つけ方

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


ERROR.TYPE

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

STYLE

Applies a style to the cell containing the formula.

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

Returns the column number of a cell reference. If the reference is a cell the column number of the cell is returned; if the parameter is a cell area, the corresponding column numbers are returned in a single-row array if the formula is entered as an array formula. If the COLUMN function with an area reference parameter is not used for an array formula, only the column number of the first cell within the area is determined.

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サーバーのデータがどのように数値に変換されるかを操作します

Mode

Effect

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 を返します。

Technical information

This function is not part of the Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format standard. The name space is

ORG.OPENOFFICE.ERRORTYPE

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 regular expression metacharacter or operator 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 関数を含むセルをクリックすると、ハイパーリンクが開きます。

If you use the optional CellValue parameter, the formula locates the URL, and then displays the text or number.

tip

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


Syntax

HYPERLINK("URL" [; CellValue])

URL specifies the link target. The optional CellValue parameter is the text or a number that is displayed in the cell and will be returned as the result. If the CellValue parameter is not specified, the URL is displayed in the cell text and will be returned as the result.

空のセルと行列要素のついては、値 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 returns a reference, a value or an array of values from a reference range, specified by row and column index number or array of row and array of columns index numbers, and an optional range index.

INDEX() returns a reference if the argument is one or more references. When used in a cell in the form =INDEX(), the reference is resolved and the values displayed. When INDEX() is used in arguments of other functions, =FUNCTION(INDEX()...), the function gets the reference passed that was returned by INDEX(). Returning a reference is different from returning an array of values for functions that handles them differently.

Syntax

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

Reference is a reference, entered either directly or by specifying a range name. If the reference consists of multiple ranges, you must enclose the list of references or range names in parentheses, or either use the tilde (~) range concatenation operator or define a named range with multiple areas.

Row (optional) represents the row or the array of row indexes of the reference range, for which to return a value. In case of zero or omitted (no specific row) all referenced rows are returned.

Column (optional) represents the column or array of column indexes of the reference range, for which to return a value. In case of zero or omitted (no specific column) all referenced columns are returned.

note

If Row, Column or both are omitted or defined as arrays of indexes, the INDEX function must be entered as an array function.


Range (optional) represents the index of the subrange if referring to a multiple range, default is 1.

Example

{=INDEX({1,3,5;7,9,10},{2;1},1)} return a 2 row array containing 7 and 1. The row index {2;1} pick row 2 then row 1. The columns index 1 picks the first column.

{=INDEX(D3:G12,{1;2;3;4},{3,1})} return a 4 rows by 2 columns array. The row index array {1;2;3;4} picks rows 3 to 6 and {3;1} picks the third (F) and first column (D). Columns 1 and 3 of the source reference are swapped in the resulting array.

=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)} returns the values of the first row of A1:B6. Enter the formula as an array formula.

{=INDEX(A1:B6;0;1)} returns the values of the first column of A1:B6. Enter the formula as an array formula.

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

{=INDEX((A1:B6;C1:D6);0;0;2)} returns the values of the second range C1:D6 of the multiple range. Enter the formula as an array formula.

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 regular expression metacharacter or operator 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).

If Type = 1 or the third parameter is missing, the index of the last value that is smaller or equal to the search criterion is returned. For Type = -1, the index of the last value that is larger or equal is returned.

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 regular expression metacharacter or operator 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

Returns the row number of a cell reference. If the reference is a cell, it returns the row number of the cell. If the reference is a cell range, it returns the corresponding row numbers in a one-column Array if the formula is entered as an array formula. If the ROW function with a range reference is not used in an array formula, only the row number of the first range cell will be returned.

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 を返します。

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 regular expression metacharacter or operator 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 を指定します。こうすると、存在しない番号が入力された場合にエラーメッセージが表示されます。

ご支援をお願いします!