Array Functions

Táto kategória obsahuje maticové funkcie.

Čo je to matica?

Matica je súvislá oblasť buniek, ktoré obsahujú nejaké hodnoty. Štvorcová oblasť 3 riadkov a 3 stĺpcov je matica 3 x 3:

A

B

C

D

E

1

7

31

33

2

95

17

2

3

5

10

50

4


Pre náš tabuľkový kalkulátor je najmenšia možná matica 1 x 2 alebo 2 x 1, pozostávajúca z dvoch priľahlých buniek.

Čo je to maticový vzorec?

Maticový vzorec hovoríme takému vzorcu, v ktorom vystupujú hodnoty celej oblasti buniek. Rozdiel medzi maticovým vzorcom a inými vzorcami je ten, že maticový vzorec namiesto jednej hodnoty operuje s viacerými hodnotami naraz.

Nielenže maticový vzorec spracováva niekoľko hodnôt naraz, ale tiež môže viacero hodnôt naraz vrátiť. Presnejšie povedané, výsledok maticového vzorca môže byť tiež matica.

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.

Okrem násobenia je tiež možné použiť na daný rozsah buniek (matica) aj iných operátorov. V programe LibreOffice Calc môžete sčítať (+), odčítať (-), násobiť (*), deliť (/), používať exponenty (^), spojovať reťazce (&) a porovnávať (=, <>, <, >, <=, >=). Tieto operátory môžu byť použití na každú jedinečnú hodnotu v danom rozsahu buniek a pri použití v maticovom vzorci vracajú ako výsledok maticu.

Porovnávajúce operátory vo vzorci spracovávajú prázdne bunky rovnakým spôsobom ako normálny vzorec, ktorý existuje buď ako nula alebo ako prázdny reťazec. Napríklad, ak sú bunky A1 a A2 prázdne, oba vzorce {=A1:A2=""} a {=A1:A2=0} vrátia jeden stĺpec a 2 riadky obsahujúce TRUE.

Kedy použiť maticový vzorec?

Maticové vzorce použijete vtedy, ak musíte pre rôzne sady hodnôt robiť opakované výpočty. Ak sa neskôr rozhodnete zmeniť spôsob výpočtu, stačí zmeniť iba jeden maticový vzorec. Pre úpravu maticového vzorca vyberte všetky bunky z rozsahu matice a potom už môžete urobiť v maticovom vzorci požadované zmeny.

Použitie maticových vzorcov je tiež úsporné riešenie výpočtu viacerých položiek naraz, pretože tieto maticové výpočty nie sú príliš pamäťovo náročné. Naviac sa jedná o základný nástroj pre uskutočnenie zložitých výpočtov, pretože je možné do výpočtu zahrnúť niekoľko rozsahov buniek naraz. LibreOffice má pre matice špeciálne funkcie, ako napríklad MMULT pre násobenie dvoch matíc alebo SUMPRODUCT pre výpočet ich skalárneho súčinu.

Použitie maticových vzorcov v programe LibreOffice Calc

Implicit intersection of array formulas

You can also create a "normal" formula in which the reference range, such as parameters, indicate an array formula. This formula is also known as "implicit intersection" of array formula. The result is obtained from the intersection of the reference range and the rows or columns in which the formula is found. If there is no intersection or if the range at the intersection covers several rows or columns, a #VALUE! error message appears. The following example illustrates this concept:

In the table above, place the array formula in D1:

{=A1:A3 + 100}

Cells D1, D2, D3 have values 107, 195, 105 respectively.

Insert the formula below in E2, do not enter as array formula.

=A1:A3 + 100

Cells E1 and E3 are empty, Cell E2 has value 195. This is the implicit intersection of array formulas.

Insert formula below in E4, as in E2.

=A1:A3 + 100

Cell E4 display #VALUE!. Row 4 is out of the range A1:A3 of the formula.

Vytváranie maticových vzorcov

Ak vytvárate maticový vzorec s použitím Sprievodca funkciou, musíte zakaždým zaškrtnúť políčko Matice. Potom budú výsledky výpočtu vrátené ako matice; v opačnom prípade bude vrátená iba hodnota bunky v ľavom hornom rohu zvoleného rozsahu.

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

Maticové vzorce sa v programe LibreOffice Calc zobrazujú v zložených zátvorkách. Jednoduchým ručným pridaním zložených zátvoriek však maticový vzorec nie je možné vytvoriť.


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.


Použitie vložených matíc vo vzorcoch

Calc podporuje vo vzorcoch vložené matice. Vložená matica je uzavretá v zložených zátvorkách '{' a '}'. Prvky matice môžu byť čísla (aj záporné), logické konštanty (TRUE, FALSE) alebo reťazec. Nie sú povolené nekonštantné výrazy. Maticu je možné zadať s jedným či viacerými stĺpcami a jedným či viacerými riadkami. Každý riadok musí obsahovať rovnaký počet prvkov, každý stĺpec musí obsahovať rovnaký počet prvkov.

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.


Matice nemôžu byť vnorené.

Príklady:

={1;2;3}

Matice s jedným riadkom obsahujúcim tri čísla 1, 2 a 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}

Matice s dvoma riadkami a troma hodnotami v každom riadku.

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

Matice so zmiešanými hodnotami.

=SIN({1;2;3})

Ak je funkcia zadaná ako maticový vzorec, vráti výsledok troch výpočtov SIN pre argumenty 1, 2 a 3.

Úpravy maticových vzorcov

  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

Je možné formátovať jednotlivé časti matice. Je napríklad možné zmeniť farbu písma. Vyberte rozsah buniek a potom zmeňte ľubovoľný znak.


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.

Kopírovanie maticových vzorcov

  1. Vyberte rozsah buniek alebo maticu obsahujúcu maticový vzorec.

  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.

Úprava rozsahu matice

Ak chcete upraviť výsledkovú maticu, urobte nasledujúce:

  1. Vyberte rozsah buniek alebo maticu obsahujúcu maticový vzorec.

  2. V pravom dolnom rohu výberu sa zobrazí ikona malého štvorca, ktorého pretiahnutím je možné rozšíriť alebo zmenšiť oblasť matice.

note

Keď upravíte rozsah matice, samotný maticový vzorec nebude automaticky upravený. Meníte totiž len oblasť buniek, v ktorej sa objavia výsledky.


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

Podmienené maticové výpočty

Podmienený maticový výpočet je maticový vzorec, v ktorom sú použité funkcie IF() alebo CHOOSE(). Argument podmienky je rozsah buniek.

V nasledujúcom príklade je podmienka >0 vzorca {=IF(A1:A3>0;"áno";"nie")} použitá na každú bunku v rozsahu A1:A3 a výsledok je skopírovaný do príslušnej bunky.

A

B (vzorec)

B (výsledok)

1

1

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

áno

2

0

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

nie

3

1

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

áno


Nasledujúce funkcie poskytujú vynútené spracovanie matíc: CORREL, COVAR, FORECAST, FTEST, INTERCEPT, MDETERM, MINVERSE, MMULT, MODE, PEARSON, PROB, RSQ, SLOPE, STEYX, SUMPRODUCT, SUMX2MY2, SUMX2PY2, SUMXMY2, TTEST. Ak je argumentom funkcia použiť rozsah buniek (matica), funkcia sa chová ako maticová. Nasledujúca tabuľka poskytuje príklady vynúteného spracovania matíc:

A

B (vzorec)

B (výsledok)

C (vynútený maticový vzorec)

C (výsledok)

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(Dáta; Triedy)

Data predstavuje odkaz na hodnoty, ktoré sa majú spočítať.

Triedy predstavujú maticu obmedzujúcich hodnôt.

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

Všeobecný úvod do maticových funkcií nájdete na začiatku tejto stránky.


Example

Stĺpec A v nasledujúcej tabuľke obsahuje neroztriedené hodnoty meraní. Stĺpec B obsahuje hornú medzu intervalov, do ktorých chceme rozdeliť údaje zo stĺpca A. Funkcia FREQUENCY použije hodnotu v B1 na to, aby vrátila počet hodnôt meraní, ktoré sú menšie alebo rovné 5. Na základe hodnoty B2 zasa funkcia FREQUENCY vráti počet nameraných hodnôt, ktoré sú väčšie ako 5, alebo menšie alebo rovné 10. Text ">25" zadaný do B6 slúži iba pre lepšiu názornosť.

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


Vyberte jednostĺpcový rozsah buniek, do ktorých chcete vložiť počet zdrojových hodnôt. Musíte vybrať o jednu bunku viac než je počet tried, do tejto bunky bude vložený počet hodnôt, ktoré prekračujú horný limit poslednej triedy. V tomto príklade vyberte bunky C1:C6. V Sprievodcovi funkcií zvoľte funkciu FREQUENCY. Ako Dáta ďalej zadajte rozsah buniek obsahujúcich hodnoty meraní (A1:A11) a tiež stĺpec obsahujúci hornú medzu skúmaných intervalov ako Triedy ; teda bunky B1:B6. Zaškrtnite políčko Matice a kliknite na OK. V pôvodne označenom rozsahu buniek C1:C6 teraz vidíte počet hodnôt meraní v príslušných intervaloch.

More explanations on top of this page.

GROWTH

Vypočíta body ležiace na exponenciálnej regresívnej krivke.

Syntax

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

DátaY reprezentuje dáta Y.

DátaX (voliteľné) reprezentuje dáta X.

NovéDátaX (voliteľné) reprezentujú dáta X, v ktorých budú prepočítané hodnoty.

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

Returns a table of statistics for a straight line that best fits a data set.

Syntax

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

data_Y is a single row or column range specifying the y coordinates in a set of data points.

data_X is a corresponding single row or column range specifying the x coordinates. If data_X is omitted it defaults to 1, 2, 3, ..., n. If there is more than one set of variables data_X may be a range with corresponding multiple rows or columns.

LINEST finds a straight line y = a + bx that best fits the data, using linear regression (the "least squares" method). With more than one set of variables the straight line is of the form 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

This function returns an array and is handled in the same way as the other array functions. Select a range for the answers and then the function. Select data_Y. If you want, you can enter other parameters. Select Array and click OK.

The results returned by the system (if stats = 0), will at least show the slope of the regression line and its intersection with the Y axis. If stats does not equal 0, other results are to be displayed.

Ďalšie výsledky funkcie LINEST:

Nasledujúca tabuľka slúži ako príklad popisu ďalších výsledkov:

A

B

C

D

E

F

G

1

x1

x2

y

Eva

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


Stĺpec A obsahuje niekoľko hodnôt X1, stĺpec B niekoľko hodnôt X2 a stĺpec C hodnoty Y. Tieto hodnoty už boli zadané. Teraz označíte rozsah buniek E2:G6 a spustíte Sprievodcu funkciou. Aby funkcia LINEST fungovala, musíte zaškrtnúť políčko Matica v Sprievodcovi funkciou. Teraz zadajte nasledujúce hodnoty (označte príslušné rozsahy buniek myší, alebo ich zapíšte pomocou klávesnice):

data_Y is C2:C8

data_X is A2:B8

linearType and stats are both set to 1.

Akonáhle kliknete na OK, LibreOffice Calc doplní výsledky funkcie LINEST tak, ako je uvedené v ukážke.

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

Toto sú ďalšie hodnoty vypočítané funkciou LINEST:

E2 a F2: Smernica m regresívnej línie y=b+m*x pre hodnoty x1 a x2. Hodnoty sú dané v opačnom poradí, tzn. smernica pre x2 v E2 a smernica pre x1 v F2.

G2: Prenik s osou y (hodnota b).

E3 a F3: Štandardná odchýlka hodnoty smernice.

G3: Štandardná odchýlka prieniku s osou y.

E4: RSQ (Druhá mocnina Pearsonovho korelačného koeficientu).

F4: Štandardná odchýlka regresie vypočítaná pre hodnotu y.

E5: Hodnota F z analýzy rozptylu.

F5: Stupne voľnosti získané z analýzy rozptylu.

E6: Súčet štvorcov odchýlok predpokladaných hodnôt y od ich lineárneho priemeru.

F6: Súčet štvorcov odchýlok predpokladaných hodnôt y od zadaných hodnôt y.

More explanations on top of this page.

LOGEST

Táto funkcia vypočíta korekciu zadaných hodnôt vo forme exponenciálnej regresívnej funkcie (y=b*m^x).

Syntax

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

DátaY reprezentuje dáta Y.

DátaX (voliteľné) reprezentuje dáta X.

TypFunkcie (voliteľné). Ak je Typ_Funkcie = 0, bude vypočítaná funkcia v tvare y = m^x. Inak sa vypočíta funkcia y = b*m^x.

Parameter (voliteľný). Ak Parameter = 0, bude vypočítaný iba regresívny koeficient.

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

Viď. LINEST. V tomto prípade ale nebudú vrátené žiadne súčty druhých mocnín.

MDETERM

Vracia determinant matice. Táto funkcia vloží do aktuálnej bunky jedinú hodnotu, nie je treba pre výsledky rezervovať väčší rozsah buniek.

Syntax

MDETERM(Matica)

Matica predstavuje štvorcovú maticu (rozsah buniek), ktorej determinant bude vypočítaný.

note

Všeobecný úvod do používania maticových funkcií nájdete na začiatku tejto stránky.


More explanations on top of this page.

MINVERSE

Vracia inverznú maticu.

Syntax

MINVERSE(Matica)

Matica je štvorcová matica, ku ktorej počítame inverznú maticu.

More explanations on top of this page.

Example

Vyberte štvorcový rozsah buniek a funkciu MINVERSE. Vyberte cieľový rozsah buniek, zaškrtnite políčko Matica a kliknite na OK.

MMULT

Spočíta maticový súčin dvoch matíc. Počet stĺpcov prvej matice sa musí rovnať počtu riadkov druhej matice. Štvorcová matica má rovnaký počet riadkov i stĺpcov.

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

Vráti jednotkovú štvorcovú maticu danej veľkosti. Jednotková matica je štvorcová matica, ktorá má na diagonále jednotky a jej ostatné prvky majú hodnotu 0.

Syntax

MUNIT(Rozmery)

Rozmery určujú veľkosť matice.

note

Všeobecný úvod do maticových funkcií nájdete na začiatku tejto stránky.


Example

Vyberte štvorcový rozsah buniek, napríklad A1 až E5.

Bez toho aby ste zrušili vybraný rozsah, zvoľte funkciu MUNIT. Zaškrtnite políčko Matice. Zadajte požadované rozmery, v tomto prípade 5 a kliknite na OK.

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

V rozsahu buniek A1:E5 teraz vidíte jednotkovú maticu.

More explanations on top of this page.

SUMPRODUCT

Vynásobí zodpovedajúce prvky v zadaných maticiach a vráti súčet týchto súčinov.

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) vráti 397.

Výpočet: A1*C1 + B1*D1 + A2*C2 + B2*D2 + A3*C3 + B3*D3

Funkciu SUMPRODUCT je možné použiť pre výpočet skalárneho súčinu dvoch vektorov.

note

Funkcia SUMPRODUCT vracia jediné číslo, nie je potrebné ju zadávať ako maticovú funkciu.


More explanations on top of this page.

SUMX2MY2

Vracia súčet rozdielov druhých mocnín zodpovedajúcich si hodnôt dvoch matíc.

Syntax

SUMX2MY2(PoleX; PoleY)

PoleX reprezentuje prvé pole, ktorého elementy budú umocnené na druhú a pridané.

PoleY reprezentuje druhé pole, ktorého elementy budú umocnené na druhú a odpočítané.

More explanations on top of this page.

SUMX2PY2

Vráti súčet súčtov druhých mocnín zodpovedajúcich si hodnôt v dvoch poliach.

Syntax

SUMX2PY2(PoleX; PoleY)

PoleX reprezentuje prvé pole, ktorého elementy budú umocnené na druhú a pridané.

PoleY reprezentuje druhé pole, ktorého elementy budú umocnené na druhú a odpočítané.

More explanations on top of this page.

SUMXMY2

Spočíta druhé mocniny rozdielov medzi zodpovedajúcimi si hodnotami dvoch polí.

Syntax

SUMXMY2(PoleX; PoleY)

PoleX reprezentuje prvé pole, ktorého elementy budú odpočítané a umocnené na druhú.

PoleY reprezentuje druhé pole, ktorého elementy budú odpočítané a umocnené na druhú.

More explanations on top of this page.

TRANSPOSE

Transponuje riadky a stĺpce zadanej matice.

Syntax

TRANSPOSE(Matica)

Matica označuje maticu (rozsah buniek), ktorá bude transponovaná.

note

Všeobecný úvod do používania maticových funkcií nájdete na začiatku tejto stránky.


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

Vypočíta body ležiace na regresívnej priamke.

Syntax

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

DátaY reprezentuje dáta Y.

DátaX (voliteľné) reprezentuje dáta X.

NovéDátaX (voliteľné) reprezentuje pole dát X, ktoré sú použité na prepočítanie hodnôt.

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.

Please support us!