Array Functions

このカテゴリーには、行列関数があります。

行列とは

行列は、表計算ドキュメント内で連結された、値を含むセル範囲です。3 行と 3 列の範囲は 3 x 3 行列です。

A

B

C

1

7

31

33

2

95

17

2

3

5

10

50


最小の行列は 1 x 2 または 2 つの隣接セルを持つ 2 x 1 行列です。

行列式とは

セル範囲内の個々の値が考慮される数式を、行列式と呼びます。行列式とほかの数式との違いは、前者は一度に複数の値を処理するのに対し、後者は一度に 1 つの値しか処理しない点です。

行列式は、複数の値を処理できるだけではなく、複数の値を返すこともできます。行列式の結果も行列です。

To multiply the values in the individual cells by 10 in the above array, you do not need to apply a formula to each individual cell or value. Instead you just need to use a single array formula. Select a range of 3 x 3 cells on another part of the spreadsheet, enter the formula =10*A1:C3 and confirm this entry using the key combination + Shift + Enter. The result is a 3 x 3 array in which the individual values in the cell range (A1:C3) are multiplied by a factor of 10.

乗算に加え、参照範囲 (行列) ではほかの演算子を使用することもできます。LibreOffice Calc では、加算 (+)、減算 (-)、乗算 (*)、除算 (/)、指数 (^)、連結 (&)、および比較 (=、<>、<、>、<=、>=) を行えます。演算子はセル範囲内の個々の値に対して使用でき、行列式が入力されている場合は結果を行列として返します。

行列式の比較演算子は、通常の数式と同じように、つまり、ゼロまたは空の文字列として、空白セルを扱います。たとえば、セル A1 と A2 が空白の場合、行列式 {=A1:A2=""}{=A1:A2=0} は、両方 TRUE を含むセルの 1 列 2 行の行列を返します。

行列式をいつ使用するか

異なる値を使用して計算を繰り返す必要がある場合は、行列式を使用します。行列式を使用すると、後から計算方法を変える場合でも、行列式を更新するだけで済みます。行列式を追加するには、行列範囲全体を選択し、必要に応じて行列式に変更を加えます。

行列式は、メモリーを大量に消費するわけではないので、いくつかの値を計算するときに容量を節約することもできます。さらに、行列は複雑な計算を行う場合に不可欠となるツールでもあります。これは、複数のセル範囲を計算の中に含めることができるためです。LibreOffice は、2 つの行列を乗算する MMULT 関数や、2 つの行列のスカラー積を計算する SUMPRODUCT 関数など、さまざまな数学関数を提供します。

LibreOffice Calc で行列式を使用する

また、パラメーターなどの参照範囲で行列式を示す「通常の」数式を作成することもできます。その結果は、参照範囲と、数式が含まれる行または列の共通部分から返されます。共通部分がない場合、または、共通部分の範囲に複数の行または列が含まれる場合は、#VALUE! エラーメッセージが表示されます。この概念を次の例で説明します。

行列式の作成

関数ウィザード を使用して行列式を作成する場合、作成するたびに 行列 チェックボックスをオンにして結果が行列に返されるようにする必要があります。チェックボックスをオンにしないと、計算される行列の左上のセルの値のみが返されます。

If you enter the array formula directly into the cell, you must use the key combination Shift + + Enter instead of the Enter key. Only then does the formula become an array formula.

note

LibreOffice Calc では、行列式は中かっこに囲まれて表示されます。中かっこを手入力しても行列式は作成できません。


warning

The cells in a results array are automatically protected against changes. However, you can edit, delete or copy the array formula by selecting the entire array cell range.


数式でインライン行列定数を使用する

Calc は数式でのインライン行列定数をサポートしています。 インライン行列は、中括弧「{」および「}」で囲まれています。 要素は、数字 (負の数を含む)、論理定数 (TRUE、FALSE)、文字列のいずれかにできます。 定数以外の式は許可されません。 行列は 1 行以上の行、1 列以上の列で入力できます。 すべての行は同一数の要素で構成される必要があり、すべての列は同一数の要素で構成される必要があります。

The column separator (separating elements in one row) and the row separator are language and locale dependent. But in this help content, the ';' semicolon and '|' pipe symbol are used to indicate the column and row separators, respectively. For example, in the English locale, the ',' comma is used as the column separator, while the ';' semicolon is used as the row separator.

tip

You can view and change the row and column separator in - Calc - Formula - Separators.


行列を入れ子にすることはできません。

例:

={1;2;3}

これは、1 つの行の 3 つの数字 1、2、3 で構成される行列です。

To enter this array constant, you select three cells in a row, then you type the formula ={1;2;3} using the curly braces and the semicolons, then press + Shift + Enter.

={1;2;3|4;5;6}

これは、2 つの行があり、それぞれの行に 3 つの値のある行列です。

={0;1;2|FALSE;TRUE;"two"}

これは、組み合わされたデータ行列です。

=SIN({1;2;3})

これは、行列式として入力されたものであり、引数 1、2、3 で 3 つの SIN 計算の結果を提供します。

行列式の編集

  1. Select the cell range or array containing the array formula. To select the whole array, position the cell cursor inside the array range, then press + /, where / is the division key on the numeric keypad.

  2. Either press F2 or position the cursor in the input line. Both of these actions let you edit the formula.

  3. After you have made changes, press + Shift + Enter.

tip

行列の個別部分を設定できます。たとえば、フォントの色を変更できます。セル範囲を選択し、希望の属性を変更します。


Deleting Array Formulae

  1. Select the cell range or array containing the array formula. To select the whole array, position the cell cursor inside the array range, then press + /, where / is the division key on the numeric keypad.

  2. Press Delete to delete the array contents, including the array formula, or press Backspace and this brings up the Delete Contents dialog box. Select Formula or Delete All and click OK.

行列式のコピー

  1. 行列式を含むセル範囲または行列を選択します。

  2. Either press F2 or position the cursor in the input line.

  3. Copy the formula into the input line by pressing + C.

  4. Select a range of cells where you want to insert the array formula and either press F2 or position the cursor in the input line.

  5. Paste the formula by pressing + V in the selected space and confirm it by pressing + Shift + Enter. The selected range now contains the array formula.

行列範囲の調整

出力行列を編集する場合は、次を行います。

  1. 行列式を含むセル範囲または行列を選択します。

  2. 選択したセルの右下に、マウスで拡大縮小するための小さなアイコンがあります。

note

行列範囲を調整した場合、行列式は自動的に調整されません。この場合は、結果が表示される範囲を変更しているだけです。


By holding down the key, you can create a copy of the array formula in the given range.

条件付き行列計算

条件付き行列計算では、IF() または CHOOSE() 関数を含む行列式を使用します。数式における条件付き引数とは、範囲参照または行列の結果です。

次の例では、{=IF(A1:A3>0;"yes";"no")} 式の >0 検定が A1:A3 の範囲の各セルに適用され、結果が対応するセルにコピーされます。

A

B (数式)

B (結果)

1

1

{=IF(A1:A3>0;"yes";"no")}

Yes

2

0

{=IF(A1:A3>0;"yes";"no")}

No

3

1

{=IF(A1:A3>0;"yes";"no")}

Yes


CORREL、COVAR、FORECAST、FTEST、INTERCEPT、MDETERM、MINVERSE、MMULT、MODE、PEARSON、PROB、RSQ、SLOPE、STEYX、SUMPRODUCT、SUMX2MY2、SUMX2PY2、SUMXMY2、および TTEST 関数は、強制的な行列処理を行います。これらの関数のいずれかを呼び出すときに、範囲参照を引数として使用すると、関数は行列式のようになります。強制的な行列処理の例を次の表に示します。

A

B (数式)

B (結果)

C (強制的な行列式)

C (結果)

1

1

=A1:A2+1

2

=SUMPRODUCT(A1:A2+1)

5

2

2

=A1:A2+1

3

=SUMPRODUCT(A1:A2+1)

5

3

=A1:A2+1

#VALUE!

=SUMPRODUCT(A1:A2+1)

5


FREQUENCY

Indicates the frequency distribution in a one-column-array. The function counts the number of values in the Data array that are within the values given by the Classes array.

Syntax

FREQUENCY(データ; クラス)

データ とは、数える対象となる値の参照です。

クラス とは、限界値の行列です。

note

This function ignores any text or empty cell within a data range. If you suspect wrong results from this function, look for text in the data ranges. To highlight text contents in a data range, use the value highlighting feature.


note

このページの一番上から、行列関数に関する一般情報を探せます。


Example

次の表では、列 A には並べ替えられていない測定値がリストされています。列 B には列 A のデータを分割するクラスの上限値が含まれます。B1 に入力された限界値に基づき、FREQUENCY 関数は 5 以下の測定値の数を返します。B2 の限界値が 10 であれば、FREQUENCY 関数は 2 つめの結果として 5 より大きく 10 以下の測定値を返します。B6 に入力したテキスト「>25」は、参照用としてのみ使用されます。

A

B

C

1

12

5

1

2

8

10

3

3

24

15

2

4

11

20

3

5

5

25

1

6

20

>25

1

7

16

8

9

9

7

10

16

11

33


クラスの上限値よりも大きい値の頻度を入力する、単独のセル範囲を選択します。クラスの上限値よりも 1 フィールド多く選択しなければなりません。ここでは、C1:C6 を選択します。関数ウィザード で FREQUENCY 関数を呼び出します。データ の測定範囲を (A1:A11) で選択し、次にクラス限界 (B1:B6) を入力する クラス の列を選びます。行列 チェックボックスをオンにし、OK をクリックします。最初に選択された範囲 C1:C6 に頻度が表示されます。

More explanations on top of this page.

GROWTH

行列内の指数トレンドのポイントを計算します。

Syntax

GROWTH(DataY [; [ DataX ] [; [ NewDataX ] [; FunctionType ] ] ])

データ Y は、Y データ行列を表します。

データ X (オプション) は、X データ行列を表します。

新しいデータ X (オプション) は、値を再計算する X データの行列を表します。

FunctionType (optional). If FunctionType = 0, functions in the form y = m^x will be calculated. Otherwise, y = b*m^x functions will be calculated.

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.

More explanations on top of this page.

Example

This function returns an array and is handled in the same way as the other array functions. Select a range where you want the answers to appear and select the function. Select DataY. Enter any other parameters, mark Array and click OK.

LINEST

データグループにもっとも適合した直線の統計値のテーブル (表) を返します。

Syntax

LINEST(data_Y [; data_X [; linearType [; stats]]])

data_Y はデータポイントグループの中で Y 座標を示す 1 行または列の範囲です。

data_X は、対応する 1 つの行、または、X 座標群を記述したカラム範囲です。もし、data_x が省略された場合、デフォルトは 1, 2, 3, ..., n になります。1 つ以上の変数のセットがある場合、data_Xは対応する複数の行または列の範囲になるかもしれません。

LINEST は、線形回帰 (最小二乗法) を使って、もっともデータに適合する直線 y = a + bx を見つけます。1 つ以上の変数がある場合、その直線は y = a + b1x1 + b2x2 ... + bnxn という形式のものになります。

If linearType is FALSE the straight line found is forced to pass through the origin (the constant a is zero; y = bx). If omitted, linearType defaults to TRUE (the line is not forced through the origin).

If stats is omitted or FALSE only the top line of the statistics table is returned. If TRUE the entire table is returned.

LINEST returns a table (array) of statistics as below and must be entered as an array formula (for example by using + Shift + Return rather than just Return).

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.

More explanations on top of this page.

Example

この関数は行列を返し、ほかの行列関数と同じように処理されます。回答範囲と関数を選択します。データ Y を選択します。必要な場合は、ほかのパラメーターを入力します。「行列」 を選択し、「OK」 をクリックします。

(統計が 0 の場合に) システムによって返される結果は、少なくとも回帰直線と回帰直線と Y 軸の交差を示します。統計が 0 でない場合は、ほかの結果が表示されます。

その他の LINEST の結果は以下のとおりです。

以下の例を検証します。

A

B

C

D

E

F

G

1

x1

x2

y

残存価額

2

4

7

100

4,17

-3,48

82,33

3

5

9

105

5,46

10,96

9,35

4

6

11

104

0,87

5,06

#NA

5

7

12

108

13,21

4

#NA

6

8

15

111

675,45

102,26

#NA

7

9

17

120

8

10

19

133


列 A にはいくつかの X1 値が、列 B にはいくつかの X2 値が、そして列 C には Y 値が含まれています。これらの値は、表計算ドキュメントにすでに入力されています。ここで、表計算ドキュメントに E2:G6 が設定され、関数ウィザード がオンになっています。LINEST 関数を実行するには、関数ウィザード行列 チェックボックスをオンにする必要があります。次に、表計算ドキュメントで以下の値を選択します (または、値をキーボードから入力します)。

データ Y は C2:C8 です。

データ X は A2:B8 です。

線形タイプ統計情報 の両方に 1 が設定されます。

OK をクリックすると、LibreOffice Calc は上の例に LINEST 値を入力します。

The formula in the Formula bar corresponds to each cell of the LINEST array {=LINEST(C2:C8;A2:B8;1;1)}.

これは計算結果である LINEST 値です:

E2 と* F2:x1 と x2 の値に対する回帰直線 y=b+m*x の傾き m。値は逆方向に指定されます。つまり、x2 の傾きは E2、x1 の傾きは F2 に指定されます。

G2: y 軸との交差 b

E3 および F3: 傾き値の標準誤差

G3: 切片の標準誤差

E4: RSQ

F4: Y 値の回帰の標準誤差

E5: 差異分析から得られる F 値

F5: 差異分析から得られる自由度

E6: 線形平均から導いた、Y の予測値の平方偏差の和

F6: 一定の Y 値から導いた、Y の予測値の平方偏差の和

More explanations on top of this page.

LOGEST

この関数は、入力され、調整されたデータを指数回帰曲積 (y=b*m^x) として計算します。

Syntax

LOGEST(DataY [; DataX [; FunctionType [; Stats]]])

データ Y は、Y データ行列を表します。

データ X (オプション) は、X データ行列を表します。

関数タイプ (オプション)。関数タイプ = 0 の場合は、y = m^x という形式の関数が計算されます。その他の場合は、y = b*m^x という関数が計算されます。

統計値 (オプション)。統計値=0 であれば、回帰係数のみが計算されます。

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.

More explanations on top of this page.

Example

LINEST を参照してください。ただし、平方和は返されません。

MDETERM

行列の行列式を返します。この関数は、現在のセルの値を返します。結果を返すために範囲を指定する必要はありません。

Syntax

MDETERM(行列)

行列 とは、行列式が指定される平方行列です。

note

You can find a general introduction to using Array functions on top of this page.


More explanations on top of this page.

MINVERSE

逆行列を返します。

Syntax

MINVERSE(行列)

行列 とは、逆転させる平方行列です。

More explanations on top of this page.

Example

範囲を選択してから、MINVERSE を選択します。次に、出力行列を選択し、行列 フィールドを選んでから OK をクリックします。

MMULT

2 つの行列の行列積を計算します。行列 1 の列数は、行列 2 の行数と一致しなければなりません。平方行列は、同数の行と列を持ちます。

Syntax

MMULT(Array 1; Array 2)

Array 1 represents the first array used in the array product.

Array 2 represents the second array with the same number of rows.

note

More explanations on top of this page.


Example

Select a square range. Choose the MMULT function. Select Array 1, then select Array 2. Using the Function Wizard, mark the Array check box. Click OK. The output array will appear in the first selected range.

MUNIT

一定サイズの単位平方行列を返します。単位行列とは、主要対角要素が 1、その他の行列要素が 0 になる平方行列です。

Syntax

MUNIT(寸法)

寸法 とは、行列の単位のサイズです。

note

このページの一番上から、行列関数に関する一般情報を探せます。


Example

A1 ~ E5 など、表計算ドキュメント内で範囲を選択します。

範囲の選択を解除せずに、MUNIT 関数を選択します。「行列」 チェックボックスをマークします。使用する行列単位の次数を入力します。この場合は、5 を入力します。「OK」 をクリックします。

You can also enter the =MUNIT(5) formula in the last cell of the selected range (E5), and press .

範囲が A1:E5 の単位行列が示されます。

More explanations on top of this page.

SUMPRODUCT

指定の行列内において一致する要素を乗算し、それらの積の和を返します。

Syntax

SUMPRODUCT(Array 1[; Array 2;][...;[Array 255]])

Array 1[; Array 2;][...;[Array 255]] represent arrays whose corresponding elements are to be multiplied.

At least one array must be part of the argument list. If only one array is given, all array elements are summed. If more than one array is given, they must all be the same size.

Example

A

B

C

D

1

2

3

4

5

2

6

7

8

9

3

10

11

12

13


=SUMPRODUCT(A1:B3;C1:D3) は、397 を返します。

計算: A1*C1 + B1*D1 + A2*C2 + B2*D2 + A3*C3 + B3*D3

SUMPRODUCT を使用すると、2 つの範囲のスカラー積を計算できます。

note

SUMPRODUCT は単一の値を返すので、関数を行列式として入力する必要はありません。


More explanations on top of this page.

SUMX2MY2

2 つの行列において一致する値の平方差の和を返します。

Syntax

SUMX2MY2(行列 X; 行列 Y)

行列 X は、要素が平方されて加算される最初の行列を表します。

行列 Y は、要素が平方されて減算される 2 番目の行列を表します。

More explanations on top of this page.

SUMX2PY2

2 つの行列において一致する値の平方和の和を返します。

Syntax

SUMX2PY2(行列 X; 行列 Y)

行列 X は、要素が平方されて加算される最初の行列を表します。

行列 Y は、要素が平方されて加算される 2 番目の行列を表します。

More explanations on top of this page.

SUMXMY2

2 つの行列で一致する値の偏差の平方を加算します。

Syntax

SUMXMY2(行列 X; 行列 Y)

行列 X は、要素が減算されて平方される最初の行列を表します。

行列 Y は、要素が減算されて平方される 2 番目の行列を表します。

More explanations on top of this page.

TRANSPOSE

行列の行と列を入れ替えます。

Syntax

TRANSPOSE(行列)

行列 とは、表計算ドキュメントの行列の中で行と列を入れ替えるものを指します。

note

このページの一番上から、行列関数の使用に関する一般情報を探せます。


Example

In the spreadsheet, select the range in which the transposed array can appear. If the original array has n rows and m columns, your selected range must have at least m rows and n columns. Then enter the formula directly, select the original array and press . Or, if you are using the Function Wizard, mark the Array check box. The transposed array appears in the selected target range and is protected automatically against changes.

A

B

C

D

1

2

3

4

5

2

6

7

8

9


The above table is 2 rows, 4 columns. In order to transpose it, you must select 4 rows, 2 columns. Assuming you want to transpose the above table to the range A7:B10 (4 rows, 2 columns) you must select the entire range and then enter the following:

TRANSPOSE(A1:D2)

Then make sure to enter it as matrix formula with . The result will be as follows:

A

B

7

2

6

8

3

7

9

4

8

10

5

9


TREND

線形トレンド上の値を返します。

Syntax

TREND(DataY [; DataX [; NewDataX [; LinearType]]])

データ Y は、Y データ行列を表します。

データ X (オプション) は、X データ行列を表します。

新しいデータ X (オプション) は、値の再計算に使用される X データの行列を表します。

LinearType (optional). If LinearType = 0, then lines will be calculated through the zero point. Otherwise, offset lines will also be calculated. The default is LinearType <> 0.

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.

More explanations on top of this page.

Example

Select a spreadsheet range in which the trend data will appear. Select the function. Enter the output data or select it with the mouse. Mark the Array field, click OK. The trend data calculated from the output data is displayed.

ご支援をお願いします!