Difference between revisions of "NL/Documentation/How Tos/Matrices gebruiken"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (moved Documentation/nl/How Tos/Matrices gebruiken to NL/Documentation/How Tos/Matrices gebruiken: Moving NL documentation to the NL NLC section of the Wiki)
(26 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Documentation]]
+
{{DISPLAYTITLE:Matrices gebruiken}}
[[Category:Calc]]
+
[[Category:How to]]
+
 
+
 
+
 
== Introductie ==
 
== Introductie ==
  
Line 37: Line 33:
 
== Functies die geen matrix als parameter verwachten ==
 
== Functies die geen matrix als parameter verwachten ==
  
Sommige functies, zoals <tt>'''ABS()'''</tt>, <tt>'''WORTEL()'''</tt>, <tt>'''COS()'''</tt>, <tt>'''LENGTE()'''</tt> verwachten dat hun parameters ‘scalaer’ zijn - dat betekent één enkele waarde zoals <tt>'''354'''</tt> of <tt>'''"hond"'''</tt> of de inhoud van een cel bijv.: <tt>'''B5'''</tt>.
+
Sommige functies, zoals <tt>'''ABS()'''</tt>, <tt>'''WORTEL()'''</tt>, <tt>'''COS()'''</tt>, <tt>'''LENGTE()'''</tt> verwachten dat hun parameters ‘scalair’ zijn - dat betekent één enkele waarde zoals <tt>'''354'''</tt> of <tt>'''"hond"'''</tt> of de inhoud van een cel bijv.: <tt>'''B5'''</tt>.
  
 
''Voorbeelden:''
 
''Voorbeelden:''
Line 45: Line 41:
 
:<tt>'''LENGTE("hond")'''</tt> geeft <tt>'''4'''</tt> terug.
 
:<tt>'''LENGTE("hond")'''</tt> geeft <tt>'''4'''</tt> terug.
  
U <u>kunt echter nog steeds een matrix gebruiken</u> waar één enkele wordt verwacht - ''bijvoorbeeld'' <tt>'''WORTEL( {9; 4} )'''</tt>. Als u de formule invoert door ‘normaal’ op '''Enter''' te drukken, zal Calc de formule als volgt evalueren met behulp van één enkele waarde uit de matrix.
+
U <u>kunt echter nog steeds een matrix gebruiken</u> waar één enkele waarde wordt verwacht - ''bijvoorbeeld'' <tt>'''WORTEL( {9; 4} )'''</tt>. Als u de formule invoert door ‘normaal’ op '''Enter''' te drukken, zal Calc de formule als volgt evalueren met behulp van één enkele waarde uit de matrix.
  
 
Als het een '''matrix als regel''' is:
 
Als het een '''matrix als regel''' is:
  
:Calc will use the first value (the ‘top left’).
+
:Calc za; de eerste waarde gebruiken (die ‘linksboven’).
  
:''Example:''
+
:''Voorbeeld:''
  
::<tt>'''=SQRT( {9; 4 | 25; 16} )'''</tt> then press '''Enter''' returns <tt>'''3'''</tt>, the square root of the first element in the array (<tt>'''9'''</tt>).
+
::<tt>'''=WORTEL( {9; 4 | 25; 16} )'''</tt> drukken op '''Enter''' geeft <tt>'''3'''</tt> terug, de wortel van het eerste element in de matrix (<tt>'''9'''</tt>).
  
If it is a '''range''':
+
Als het een '''bereik''' is:
  
:1. Calc will return an error unless the array is a single row or a single column.
+
:1. Calc zal een fout teruggeven, tenzij de matrix één enkele rij of één enkele kolom is.
  
:2. For a single row or a single column range, Calc will use the value where the formula cell’s column/row intersects with the array (or return an error if there is no intersection).
+
:2. Voor een bereik van één enkele rij of één enkele kolom zal Calc de waarde gebruiken van de cel waar de kolom/rij van de formule-cel kruist met de matrix (of een fout teruggeven als er geen kruising is).
  
:''Examples:''
+
:''Voorbeelden:''
  
 
<center>[[Image:Calc_array1.png]]</center>
 
<center>[[Image:Calc_array1.png]]</center>
:: The formula <tt>'''=ABS(B2:B5)'''</tt> is entered 'normally' in cell D3, that is on row 3. Row 3 intersects <tt>'''B2:B5'''</tt> at cell B3, thus the formula evaluated is <tt>'''=ABS(B3)'''</tt>.
+
:: De formule <tt>'''=ABS(B2:B5)'''</tt> wordt 'normaal' ingevoerd in cel D3, dat is op rij 3. Rij 3 kruist <tt>'''B2:B5'''</tt> bij cel B3, dus de geëvalueerde formule is <tt>'''=ABS(B3)'''</tt>.
  
 
<center>[[Image:Calc_array2.png]]</center>
 
<center>[[Image:Calc_array2.png]]</center>
:: The formula <tt>'''=LEN(B5:D5)'''</tt> is entered 'normally' in cell B1, that is in column B. Column B intersects <tt>'''B5:D5'''</tt> at cell B5, thus the formula evaluated is <tt>'''=LEN(B5)'''</tt>.
+
:: De formule <tt>'''=LENGTE(B5:D5)'''</tt> wordt 'normaal' ingevoerd in cel B1, dat is in kolom B. Kolom B kruist <tt>'''B5:D5'''</tt> bij cel B5, dus de geëvalueerde formule is <tt>'''=LENGTE(B5)'''</tt>.
  
== Array formulas ==
+
== Matrixformules ==
The real power of arrays comes when you enter a formula in a special way, as an ‘array formula’. You do this by pressing '''Cntrl-Shift-Enter''' instead of the '''Enter''' button (or by ticking the ''Array'' checkbox if you are using the Formula Wizard).
+
De echte kracht van matrices komt als u een formule op een speciale manier invoert, als een ‘matrixformule’. U doet dit door op '''Ctrl-Shift-Enter''' te drukken in plaats van op de toets '''Enter''' (of door het vakje ''Matrix'' te selecteren als u de Functie-assistent gebruikt).
  
If in cell B1 you enter <tt>'''={3; 4}'''</tt> ‘normally’ by pressing '''Enter''', the first value <tt>'''3'''</tt> is displayed in the cell.
+
Als u in cel B1 ‘normaal’ invoert <tt>'''={3; 4}'''</tt> door op '''Enter''' te drukken, wordt de eerste waarde <tt>'''3'''</tt> weergegeven in de cel.
  
If in cell B2 you type <tt>'''={3; 4}'''</tt> but press '''Cntrl-Shift-Enter''' instead of '''Enter''', the cell becomes an 'array formula'. The formula now returns the entire array <tt>'''{3; 4}'''</tt>. Cell B2 displays <tt>'''3'''</tt> and cell C2 displays <tt>'''4'''</tt>.
+
Als u in cel B2 invoert <tt>'''={3; 4}'''</tt> maar drukt op '''Ctrl-Shift-Enter''' in plaats van op '''Enter''', wordt de cel een 'matrixformule'. De formule geeft nu de gehele matrix <tt>'''{3; 4}'''</tt> terug. Cel B2 geeft <tt>'''3'''</tt> weer en cel C2 geeft <tt>'''4'''</tt> weer.
  
:''Note that if you entered the formula using the '''Enter''' key, simply selecting the cell and pressing '''Cntrl-Shift-Enter''' will not convert the cell to an array expression - you must make an actual edit (such as adding then deleting a character), or click the Function Wizard and tick the ''Array'' checkbox.''
+
:''Let er op dat als u de formule invoerde door op de toets '''Enter''' te drukken, het eenvoudigweg selecteren van de cel en te drukken op '''Ctrl-Shift-Enter''' de cel niet zal converteren naar een matrix-expressie - u moet echt een bewerking uitvoeren (zoals een teken toevoegen of verwijderen), of op de Functie-assistent klikken en het vakje ''Matrix'' selecteren.''
  
If you now try to edit cell B2, you are told that ''"you cannot change only part of an array"''.  To edit an array you must select the entire array, either with the mouse or by typing Cntrl-/ (hold the Cntrl key and press the slash key ‘/’).
+
Als u nu probeert om de cel B2 te bewerken, krijgt u een melding dat ''"u geen deel van een matrix kunt bewerken"''.  U moet de gehele matrix selecteren om die te bewerken, ofwel met de muis of door te typen Ctrl-/ (houd de Ctrl-toets ingedrukt en druk op de slash-toets ‘/’).
 
[[Image:Calc_array6.png|right]]
 
[[Image:Calc_array6.png|right]]
  
  
The formula bar indicates that this is an array formula by enclosing it in curly braces {}. You do not need to type these - they will disappear while you edit the formula, and Calc will show them again when you have finished editing.
+
De formulebalk geeft aan dat dit een matrixformule is door die met accolades te omsluiten {}. U hoeft die niet te typen - zij zullen verdwijnen als u de formule bewerkt, en Calc zal ze opnieuw weergeven als u gereed bent met bewerken.
 
<br style="clear:both;" />
 
<br style="clear:both;" />
  
== Array formula calculations ==
+
== Berekeningen met matrixformules ==
When Calc evaluates an array formula, it treats ‘unexpected arrays’ as a series of values (rather than using a single value), calculating a result for each of the array elements, and returning an <u>array of results</u>.
+
Als Calc een matrixformule evalueert, behandelt het ‘onverwachte matrices’ als een serie van waarden (in plaats van één enkele waarde te gebruiken), berekent een resultaat voor elk van de matrix-elementen en geeft een <u>resultaten-matrix</u> weer.
  
''Example:''
+
''Voorbeeld:''
 
[[Image:Calc_array3.png|right]]
 
[[Image:Calc_array3.png|right]]
:<tt>'''=SQRT( {16; 4; 25} )'''</tt> when entered by pressing '''Cntrl-Shift-Enter''' instead of '''Enter''' returns an array of results, with 1 row and 3 columns - <tt>'''{4; 2; 5}'''</tt>. If the formula is in cell B2, Calc places the results in cells B2:D2. <tt>'''4'''</tt> is placed in B2, <tt>'''2'''</tt> in C2 and <tt>'''5'''</tt> in D2.
+
:<tt>'''=WORTEL( {16; 4; 25} )'''</tt> ingevoerd met het drukken op '''Ctrl-Shift-Enter''' in plaats van '''Enter''' geeft een resultaten-matrix weer, met 1 rij en 3 kolommen - <tt>'''{4; 2; 5}'''</tt>. Als de formule in cel B2 staat, plaatst Calc de resultaten in de cellen B2:D2. <tt>'''4'''</tt> wordt geplaatst in B2, <tt>'''2'''</tt> in C2 en <tt>'''5'''</tt> in D2.
 
<br style="clear:both;" />
 
<br style="clear:both;" />
  
The process in effect works thus:
+
Het uitgevoerde proces werkt aldus:
  
#All ‘unexpected arrays’ in the same array calculation should be the same size (see this issue: Issue 46681).
+
#Alle ‘onverwachte matrices’ in dezelfde matrix-berekening zouden dezelfde afmetingen moeten hebben (zie dit issue: Issue 46681).
#The result will be returned in an array of that size.
+
#Het resultaat zal worden teruggegeven in een matrix van die afmeting.
#The calculation is done for each element in turn, with the result returned in the corresponding element of the output array.
+
#De berekening wordt, op zijn beurt, gedaan voor elk element, waarbij het resultaat wordt teruggegeven in het corresponderende element van de uitvoer-matrix.
  
''Example:''
+
''Voorbeeld:''
  
With the array formula <tt>'''=SQRT( {16; 4; 25} )'''</tt>:
+
Met de matrixformule <tt>'''=WORTEL( {16; 4; 25} )'''</tt>:
  
#There is only one array, with 1 row and 3 columns.
+
#Er is slechts één matrix, met 1 rij en 3 kolommen.
#The result will be returned in an array with 1 row and 3 columns.
+
#Het resultaat zal worden teruggeven in een matrix met 1 rij en 3 kolommen.
#The calculation is done for <tt>'''16'''</tt> first, then for <tt>'''4'''</tt>, then for <tt>'''25'''</tt>, giving the array result <tt>'''{4; 2; 5}'''</tt>.
+
#De berekening wordt eerst gedaan voor <tt>'''16'''</tt>, dan voor <tt>'''4'''</tt>, dan voor <tt>'''25'''</tt>, wat de resultaat-matrix <tt>'''{4; 2; 5}'''</tt> oplevert.
  
''Example:''
+
''Voorbeeld:''
  
With the array formula <tt>'''=SQRT( {8 | 18} * 2 )'''</tt> in cell A5:
+
Met de matrix-formule <tt>'''=WORTEL( {8 | 18} * 2 )'''</tt> in cel A5:
  
#There is only one array, with 2 rows and 1 column.
+
#Er is slechts één matrix, met 2 rijen en 1 kolom.
#The result will be returned in an array with 2 rows and 1 column.
+
#Het resultaat zal worden teruggeven in een matrix met 2 rijen en 1 kolom.
#The calculation is: first element <tt>'''SQRT(8*2) = 4'''</tt>; second element <tt>'''SQRT(18*2) = 6'''</tt>; the array result is thus <tt>'''{4 | 6}'''</tt> - that is, <tt>'''4'''</tt> in cell A5 and <tt>'''6'''</tt> in cell A6.
+
#De berekening is: eerste element <tt>'''WORTEL(8*2) = 4'''</tt>; tweede element <tt>'''WORTEL(18*2) = 6'''</tt>; de resultaat-matrix is dus <tt>'''{4 | 6}'''</tt> - dat betekent <tt>'''4'''</tt> in cel A5 en <tt>'''6'''</tt> in cel A6.
  
The result of an array expression is an array, which can be used within the formula.  
+
Het resultaat van een matrix-expressie is een matrix, die kan worden gebruikt binnen de formule.  
  
''Example:''
+
''Voorbeeld:''
  
:<tt>'''=SUM(SQRT( {16; 4; 25} ))'''</tt> as an array formula. The calculation of <tt>'''SQRT( {16; 4; 25} )'''</tt>, as before, yields a result of <tt>'''{4; 2; 5}'''</tt>, thus giving <tt>'''SUM( {4; 2; 5} )'''</tt>, returning a final result in the cell of 4+2+5 = <tt>'''11'''</tt>.
+
:<tt>'''=SOM(WORTEL( {16; 4; 25} ))'''</tt> als een matrixformule. De berekening van <tt>'''WORTEL( {16; 4; 25} )'''</tt>, als hiervoor, levert als resultaat op <tt>'''{4; 2; 5}'''</tt>, dus geeft <tt>'''SOM( {4; 2; 5} )'''</tt>, levert als totaalresultaat in de cel op van 4+2+5 = <tt>'''11'''</tt>.
  
''Example:''
+
''Voorbeeld:''
  
With the array formula <tt>'''=SUM(IF(A1:A4>0; B1:B4; 0))'''</tt>
+
Met de matrixformule <tt>'''=SOM(ALS(A1:A4>0; B1:B4; 0))'''</tt>
  
#The two arrays <tt>'''A1:A4'''</tt> and <tt>'''B1:B4'''</tt> both have 4 rows and 1 column.
+
#De twee matrices <tt>'''A1:A4'''</tt> en <tt>'''B1:B4'''</tt> hebben beide 4 rijen en 1 kolom.
#The result of the <tt>'''IF()'''</tt> array calculation will be an array of that size, which <tt>'''SUM()'''</tt> will add up.
+
#Het resultaat van de <tt>'''ALS()'''</tt>-matrixberekening zal een matrix zijn van die afmeting, die <tt>'''SOM()'''</tt> zal optellen.
#If A1>0 the first element is <tt>'''B1'''</tt>; else <tt>'''0'''</tt>. If A2>0 the second element is <tt>'''B2'''</tt>; else <tt>'''0'''</tt> .... The array presented to <tt>'''SUM()'''</tt> has the values in B1:B4 where the adjacent value in A1:A4 is >0. The final output is the sum of the values in B1:B4 for which the adjacent value in A1:A4 is >0.
+
#Als A1>0 het eerste element is <tt>'''B1'''</tt>; anders <tt>'''0'''</tt>. Als A2>0 het tweede element is <tt>'''B2'''</tt>; anders <tt>'''0'''</tt> .... De aan <tt>'''SOM()'''</tt> gepresenteerde matrix heeft de waarden in B1:B4 waar de aanliggende waarde in A1:A4 is >0. De uiteindelijke uitvoer is de som van de waarden in B1:B4 waarvoor de aanliggende waarde in A1:A4 is >0.
  
== Array functions ==
+
== Matrixfuncties ==
Some functions calculate their result as an array. If they are to <u>return</u> that array, they must be entered as an array formula, by pressing '''Cntrl-Shift-Enter''' (or by ticking the ''Array'' checkbox if you are using the Formula Wizard). If, instead, they are entered 'normally' with the '''Enter''' button, just the (single) top left element of the calculated array will be returned. These funtions are listed in the '''[[Documentation/How_Tos/Calc: Array functions|Array function category]]''', and are:
+
Sommige functies berekenen hun resultaten als een matrix. Als zij die matrix moeten <u>teruggeven</u>, moeten zij worden ingevoerd als een matrixformule, door te drukken op '''Ctrl-Shift-Enter''' (of door het vakje ''Matrix'' te selecteren als u de Functie-assistent gebruikt). Als zij, in plaats daarvan, zij 'normaal' worden ingevoerd met de '''Enter'''-toets, zal alleen het (enkele) element linksboven van de berekende matrix worden teruggegeven. Deze funties worden opgesomd in de '''[[Documentation/nl/How_Tos/Calc: Matrixfuncties|categorie Matrixfuncties]]''', en zijn:
:[[Documentation/How_Tos/Calc: MINVERSE function|MINVERSE]], [[Documentation/How_Tos/Calc: MMULT function|MMULT]], [[Documentation/How_Tos/Calc: MUNIT function|MUNIT]], [[Documentation/How_Tos/Calc: TRANSPOSE function|TRANSPOSE]], [[Documentation/How_Tos/Calc: FREQUENCY function|FREQUENCY]], [[Documentation/How_Tos/Calc: GROWTH function|GROWTH]], [[Documentation/How_Tos/Calc: LINEST function|LINEST]], [[Documentation/How_Tos/Calc: LOGEST function|LOGEST]], [[Documentation/How_Tos/Calc: TREND function|TREND]]
+
:[[Documentation/nl/How_Tos/Calc: functie INVERSEMAT|INVERSEMAT]], [[Documentation/nl/How_Tos/Calc: functie PRODUCTMAT|PRODUCTMAT]], [[Documentation/nl/How_Tos/Calc: functie EENHEIDSMAT|EENHEIDSMAT]], [[Documentation/nl/How_Tos/Calc: functie TRANSPONEREN|TRANSPONEREN]], [[Documentation/nl/How_Tos/Calc: functie INTERVAL|INTERVAL]], [[Documentation/nl/How_Tos/Calc: functie GROEI|GROEI]], [[Documentation/nl/How_Tos/Calc: functie LIJNSCH|LIJNSCH]], [[Documentation/nl/How_Tos/Calc: functie LOGSCH|LOGSCH]], [[Documentation/nl/How_Tos/Calc: functie TREND|TREND]]
  
  
''For example'': =[[Documentation/How_Tos/Calc: MUNIT function|MUNIT(2)]] entered as an array formula in cell B1 returns the 2 x 2 unit (identity) matrix as the array {1; 0 | 0; 1} - that is, cells B1, B2, C1, C2 show 1, 0, 0, 1. If this formula is entered 'normally', just the 'top left' value (1) is returned in cell B1.
+
''Bijvoorbeeld'': =[[Documentation/nl/How_Tos/Calc: functie EENHEIDSMAT|EENHEIDSMAT(2)]] ingevoerd als een matrixformule in cel B1 geeft de eenheid 2 x 2 (identiteit) matrix als de matrix {1; 0 | 0; 1} - dat betekent, cellen B1, B2, C1, C2 tonen 1, 0, 0, 1. Als deze formule 'normaal' wordt ingevoerd, wordt alleen de waarde van 'linksboven' (1) weergegeven in cel B1.
  
  
Some functions (including some listed above) take parameters that are forced to evaluate as an array formula, even when the formula is entered 'normally':
+
Sommige functies (inclusief enkele die hierboven zijn vermeld) accepteren parameters die worden gedwongen te evalueren als een matrixformule, zelfs als de formule 'normaal' wordt ingevoerd :
  
:[[Documentation/How_Tos/Calc: MDETERM function|MDETERM]], [[Documentation/How_Tos/Calc: MINVERSE function|MINVERSE]], [[Documentation/How_Tos/Calc: MMULT function|MMULT]], [[Documentation/How_Tos/Calc: SUMPRODUCT function|SUMPRODUCT]], [[Documentation/How_Tos/Calc: SUMX2MY2 function|SUMX2MY2]], [[Documentation/How_Tos/Calc: SUMX2PY2 function|SUMX2PY2]], [[Documentation/How_Tos/Calc: SUMXMY2 function|SUMXMY2]], [[Documentation/How_Tos/Calc: CORREL function|CORREL]], [[Documentation/How_Tos/Calc: COVAR function|COVAR]], [[Documentation/How_Tos/Calc: FORECAST function|FORECAST]], [[Documentation/How_Tos/Calc: FTEST function|FTEST]], [[Documentation/How_Tos/Calc: INTERCEPT function|INTERCEPT]], [[Documentation/How_Tos/Calc: MODE function|MODE]], [[Documentation/How_Tos/Calc: PEARSON function|PEARSON]], [[Documentation/How_Tos/Calc: PROB function|PROB]], [[Documentation/How_Tos/Calc: RSQ function|RSQ]], [[Documentation/How_Tos/Calc: SLOPE function|SLOPE]], [[Documentation/How_Tos/Calc: STEYX function|STEYX]], [[Documentation/How_Tos/Calc: TTEST function|TTEST]]  
+
:[[Documentation/nl/How_Tos/Calc: functie DETERMINANT.MAT|DETERMINANT.MAT]], [[Documentation/nl/How_Tos/Calc: functie INVERSEMAT|INVERSEMAT]], [[Documentation/nl/How_Tos/Calc: functie PRODUCTMAT|PRODUCTMAT]], [[Documentation/How_Tos/Calc: functie SOMPRODUCT|SOMPRODUCT]], [[Documentation/nl/How_Tos/Calc: functie SOM.X2MINY2|SOM.X2MINY2]], [[Documentation/nl/How_Tos/Calc: functie SOM.X2PLUSY2|SOM.X2PLUSY2]], [[Documentation/nl/How_Tos/Calc: functie SOM.XMINY.2|SOM.XMINY.2]], [[Documentation/nl/How_Tos/Calc: functie CORRELATIE|CORRELATIE]], [[Documentation/nl/How_Tos/Calc: functie COVARIANTIE|COVARIANTIE]], [[Documentation/How_Tos/Calc: functie VOORSPELLEN|VOORSPELLEN]], [[Documentation/nl/How_Tos/Calc: functie F.TOETS|F.TOETS]], [[Documentation/How_Tos/Calc: functie SNIJPUNT|SNIJPUNT]], [[Documentation/nl/How_Tos/Calc: functie MODUS|MODUS]], [[Documentation/nl/How_Tos/Calc: functie PEARSON|PEARSON]], [[Documentation/nl/How_Tos/Calc: functie KANS|KANS]], [[Documentation/nl/How_Tos/Calc: functie R.KWADRAAT|R.KWADRAAT]], [[Documentation/nl/How_Tos/Calc: functie STIJGING|STIJGING]], [[Documentation/nl/How_Tos/Calc: functie STFOUTYX|STFOUTYX]], [[Documentation/nl/How_Tos/Calc: functie T.TOETS|T.TOETS]]  
  
  
''For example'': [[Documentation/How_Tos/Calc: MODE function|MODE(ABS(A1:A3))]] (in normal mode) forces ABS(A1:A3) to be evaluated as an array formula, returning an array of the absolute values of A1:A3 from which MODE selects the most common value to be returned.
+
''Bijvoorbeeld'': [[Documentation/nl/How_Tos/Calc: functie MODUS|MODUS(ABS(A1:A3))]] (in normale modus) forceeert dat ABS(A1:A3) wordt geëvalueerd als een matrixformule, die een matrix teruggeeft van de absolute waarden van A1:A3 van waaruit MODUS de meest algemene waarde selecteert om te worden teruggegeven.
  
''For example'': [[Documentation/How_Tos/Calc: PROB function|PROB(A1:A5; B1:B5/100; 3)]] (in normal mode) forces B1:B5/100 to be evaluated as an array formula, returning an array where each value is one hundredth of its value in B1:B5 (perhaps because the probabilities were expressed in percent).
+
''Bijvoorbeeld'': [[Documentation/nl/How_Tos/Calc: functie KANS|KANS(A1:A5; B1:B5/100; 3)]] (in normale modus) forceert dat B1:B5/100 wordt geëvalueerd als een matrixformule, die een matrix teruggeeft waarin elke waarde één honderdste van zijn waarde in B1:B5 is (misschien omdat de kansen werden uitgedrukt in procenten).
  
  
A few of these functions have some (array) parameters that are forced to evaluate as an array formula, and other (single value) parameters that evaluate normally.
+
Een aantal van deze functies hebben enkele (matrix)-parameters die worden geforceerd om te worden geëvalueerd als een matrixformule, en andere (enkele waarde)-parameters die normaal evalueren.
  
''For example'': [[Documentation/How_Tos/Calc: PROB function|PROB(A1:A5; B1:B5; {3; 4})]] (in normal mode) does not evaulate {3; 4} as an array, because this would mean PROB returning an array. It evaluates PROB(A1:A5; B1:B5; 3) - that is, it interprets {3; 4} in scalar mode, taking the 'top left' value 3. However, if entered as an array formula it will of course return an array.
+
''Bijvoorbeeld'': [[Documentation/nl/How_Tos/Calc: functie KANS|KANS(A1:A5; B1:B5; {3; 4})]] (in normale modus) evalueert {3; 4} niet als een matrix, omdat dit zou betekenen dat KANS een matrix teruggeeft. Het evalueert KANS(A1:A5; B1:B5; 3) - dat betekent, het interpreteert {3; 4} in scalaire modus, door de waarde 'linksboven' 3 te nemen. Indien het echter wordt ingevoerd al;s een matrixformule, zal het natuurlijk een matrix teruggeven.
  
== Tips and Tricks ==
+
== Tips en trucs ==
<u>All these examples are to be entered as an array expression, by pressing '''Cntrl-Shift-Enter'''.</u>
+
<u>Al deze voorbeelden moeten worden ingevoerd als een matrix-expressie, door op '''Ctrl-Shift-Enter''' te drukken.</u>
  
====Sum of entries matching multiple conditions====
+
====Som van items die overeenkomen met meerdere voorwaarden====
<tt>'''SUM( (A1:A6="red")*(B1:B6="big")*C1:C6 )'''</tt> returns the sum of entries in C1:C6 whose A column entries are <tt>'''"red"'''</tt> AND whose B column entries are <tt>'''"big"'''</tt>. A1:A6 and B1:B6 each produce a 6 element array of <tt>'''TRUE'''</tt> or <tt>'''FALSE'''</tt> - which in number calculations are <tt>'''1'''</tt> or <tt>'''0'''</tt>. Thus if A2 contains <tt>'''"red"'''</tt> and B2 contains <tt>'''"big"'''</tt> the second element of the array is <tt>'''1 * 1 * C2 = C2'''</tt>. If A2 contains <tt>'''"blue"'''</tt> instead, the second element of the array is <tt>'''0 * 1 * C2 = 0'''</tt>.
+
<tt>'''SOM( (A1:A6="rood")*(B1:B6="groot")*C1:C6 )'''</tt> geeft de som van de items in C1:C6 waarvan de items in kolom A zijn <tt>'''"rood"'''</tt> EN waarvan de items in kolom B zijn <tt>'''"groot"'''</tt>. A1:A6 en B1:B6 maken elk een matrix van 6 elementen met <tt>'''WAAR'''</tt> of <tt>'''ONWAAR'''</tt> - die in het geval van berekeningen zijn: <tt>'''1'''</tt> of <tt>'''0'''</tt>. Dus als A2 <tt>'''"rood"'''</tt> bevat en B2 bevat <tt>'''"groot"'''</tt> dan is het tweede element van de matrix <tt>'''1 * 1 * C2 = C2'''</tt>. Als A2 in plaats daarvan <tt>'''"blauw"'''</tt> bevat, wordt het tweede element van de matrix <tt>'''0 * 1 * C2 = 0'''</tt>.
  
<tt>'''SUM( ((A1:A6="red")+(B1:B6="big")>0)*C1:C6 )'''</tt> returns the sum of entries in C1:C6 whose A column entries are <tt>'''"red"'''</tt> OR whose B column entries are <tt>'''"big"'''</tt>.
+
<tt>'''SOM( (A1:A6="rood")+(B1:B6="groot")*C1:C6 )'''</tt> geeft de som van de items in C1:C6 waarvan de items in kolom A zijn <tt>'''"rood"'''</tt> OF waarvan de items in kolom B <tt>'''"groot"'''</tt> zijn.
  
<tt>'''SUM( MOD((A1:A6="red")+(B1:B6="big");2)*C1:C6 )'''</tt> returns the sum of entries in C1:C6 either whose A column entries are <tt>'''"red"'''</tt> OR whose B column entries are <tt>'''"big"'''</tt> but not both (exclusive OR)
+
<tt>'''SOM(REST(A1:A6="rood")+(B1:B6="groot")*C1:C6 )'''</tt> geeft ofwel de som van de items in C1:C6 waarvan de items in kolom A zijn <tt>'''"rood"'''</tt> of waarvan de items in kolom B <tt>'''"groot"'''</tt> zijn, maar niet beide (exclusieve OF)
  
<tt>'''SUM( NOT((A1:A6="red")+(B1:B6="big"))*C1:C6 )'''</tt> returns the sum of entries in C1:C6 where neither the A column entry is <tt>'''"red"'''</tt> NOR the B column entry is <tt>'''"big"'''</tt>.
+
<tt>'''SOM( NIET(A1:A6="rood")+(B1:B6="groot")*C1:C6 )'''</tt> geeft de som van de items in C1:C6 waarvan de items in kolom A niet <tt>'''"rood"'''</tt> zijn NOCH waarvan de items in kolom B <tt>'''"groot"'''</tt> zijn.
  
====Count of entries matching multiple conditions====
+
====Tellen van items die overeenkomen met meerdere voorwaarden====
<tt>'''SUM( (A1:A6="red")*(B1:B6="big") )'''</tt> returns the number of rows whose A column entries are <tt>'''"red"'''</tt> AND whose B column entries are <tt>'''"big"'''</tt>.
+
<tt>'''SOM( (A1:A6="rood")*(B1:B6="groot") )'''</tt> geeft het aantal rijen terug waarvan de items in kolom A zijn <tt>'''"rood"'''</tt> EN waarvan de items in kolom B <tt>'''"groot"'''</tt> zijn.
  
====Maximum in a particular month====
+
====Maximum in een bepaalde maand====
<tt>'''MAX(IF(MONTH(B1:B9)=5; C1:C9; 0))'''</tt> returns the maximum value in C1:C9 where the corresponding B1:B9 date is in May (month <tt>'''5'''</tt>). The <tt>'''MIN()'''</tt> function would provide the minimum in the month.
+
<tt>'''MAX(ALS(MAAND(B1:B9)=5; C1:C9; 0))'''</tt> geeft de maximale waarde terug in C1:C9 waarvan de overeenkomende datum in B1:B9 in Mei is (maand <tt>'''5'''</tt>). De functie <tt>'''MIN()'''</tt> zou de minimale waarde van die maand teruggeven.
  
====Average of entries meeting a condition====
+
====Gemiddelde van items die aan een voorwaarde voldoen====
<tt>'''AVERAGE(IF(A1:A9="red"; B1:B9; ""))'''</tt> returns the average of entries in B1:B9 whose A column entries are <tt>'''“red”'''</tt>. The <tt>'''AVERAGE'''</tt> function ignores any blank entries.
+
<tt>'''GEMIDDELDE(ALS(A1:A9="rood"; B1:B9; ""))'''</tt> geeft het gemiddelde terug van de items B1:B9 waarvan de items in kolom A <tt>'''“rood”'''</tt> zijn. De functie <tt>'''GEMIDDELDE'''</tt> negeert alle blanco items.
  
The <tt>'''MEDIAN'''</tt> function can be used similarly.
+
De functie <tt>'''MEDIAAN'''</tt> kan op dezelfde wijze worden gebruikt.
  
====Dynamic sorting of a column====
+
====Dynamisch sorteren van een kolom====
<tt>'''=LARGE(B3:B9;ROW(B3:B9)+1-ROW(B3))'''</tt> entered in cell C3 returns an array in C3:C9 which is B3:B9 in descending order. <tt>'''+1-ROW(3)'''</tt> is a constant - you could write <tt>'''=LARGE(B3:B9;ROW(B3:B9)-2)'''</tt> instead.
+
<tt>'''=GROOTSTE(B3:B9;RIJ(B3:B9)+1-RIJ(B3))'''</tt> ingevoerd in cel C3 geeft een matrix terug in C3:C9 waarbij B3:B9 in aflopende volgorde staat. <tt>'''+1-RIJ(3)'''</tt> is een constante - u zou in plaats daarvan kunnen schrijven <tt>'''=GROOTSTE(B3:B9;RIJ(B3:B9)-2)'''</tt>.
  
<tt>'''=SMALL(B3:B9;ROW(B3:B9)-2)'''</tt> returns B3:B9 in ascending order.
+
<tt>'''=KLEINSTE(B3:B9;RIJ(B3:B9)-2)'''</tt> geeft B3:B9 terug in oplopende volgorde.
  
====Sum ignoring errors====
+
====Fouten negeren met SOM====
<tt>'''SUM( IF(ISERROR(A1:A9); 0; A1:A9) )'''</tt>. Normally <tt>'''SUM'''</tt> will propagate any error found.
+
<tt>'''SOM( ALS(ISFOUT(A1:A9); 0; A1:A9) )'''</tt>. Normaal gesproken zal <tt>'''SOM'''</tt> een gevonden fout vermelden.
  
====Average, ignoring zero entries====
+
====Gemiddelde, blanco items negeren====
<tt>'''AVERAGE(IF(B1:B9<>0; B1:B9; ""))'''</tt>
+
<tt>'''GEMIDDELDE(ALS(B1:B9<>0; B1:B9; ""))'''</tt>
  
====Test a cell for one of a set of values====
+
====Een cel testen op een verzameling waarden====
<tt>'''OR(B2={2; 5; 6})'''</tt> as an array expression, or <tt>'''OR(B2=2; B2=5; B2=6)'''</tt> as a ‘normal’ formula.
+
<tt>'''OF(B2={2; 5; 6})'''</tt> als een matrix-expressie, of <tt>'''OF(B2=2; B2=5; B2=6)'''</tt> als een ‘normale’ formule.
  
====Sum of the smallest 4 numbers====
+
====Som  van de 4 kleinste getallen====
<tt>'''SUM(SMALL(B3:B9; {1;2;3;4}))'''</tt> or
+
<tt>'''SOM(KLEINSTE(B3:B9; {1;2;3;4}))'''</tt> of
<tt>'''SUM(SMALL(B3:B9;ROW(A1:A4)))'''</tt>. <tt>'''ROW(A1:A4)'''</tt> produces <tt>'''{1;2;3;4}'''</tt>.
+
<tt>'''SOM(KLEINSTE(B3:B9;RIJ(A1:A4)))'''</tt>. <tt>'''RIJ(A1:A4)'''</tt> produceert <tt>'''{1;2;3;4}'''</tt>.
  
====Last used cell in a column====
+
====Laatste gebruikte cel in een kolom====
<tt>'''MAX(ROW(B1:B9)*(B1:B9<>""))'''</tt> returns the row number of the last cell used.
+
<tt>'''MAX(RIJ(B1:B9)*(B1:B9<>""))'''</tt> geeft het rijnummer terug van de laatste gebruikte cel.
  
== Issues ==
+
== Problemen==
* Inline arrays work in OOo2.3, but fail if there are any spaces, or negative numbers. This is fixed for OOo2.4, although spaces are removed rather than ignored ([http://qa.openoffice.org/issues/show_bug.cgi?id=82644 issue 82644]).
+
* "Matrices als regel" werken in OOo2.3, maar falen als er spaties zijn of negatieve getallen. Dit is opgelost voor OOo2.4, hoewel spaties worden verwijderd in plaats van genegeerd ([http://qa.openoffice.org/issues/show_bug.cgi?id=82644 issue 82644]).
* It will be possible to include different size arrays in a formula, as there is a defined calculation process in the forthcoming international standard ODFF. Calc should comply in OOo3.0 ([http://qa.openoffice.org/issues/show_bug.cgi?id=46681 issue 46681]).
+
* Het zal mogelijk zijn om matrices van verschillende afmetingen op te nemen in een formule, omdat er een gedefinieerd berekeningsproces bestaat in de aanstaande internationale standaard ODFF. Calc zou daar in OOo3.0 aan moeten voldoen ([http://qa.openoffice.org/issues/show_bug.cgi?id=46681 issue 46681]).
* Some functions cannot yet be used in array formulas: <tt>'''COUNTIF'''</tt>, <tt>'''SUMIF'''</tt> ([http://qa.openoffice.org/issues/show_bug.cgi?id=65866 issue 65866]); <tt>'''MATCH'''</tt> ([http://qa.openoffice.org/issues/show_bug.cgi?id=8947 issue 8947]); <tt>'''ISLOGICAL'''</tt> ([http://qa.openoffice.org/issues/show_bug.cgi?id=87219 issue 87219]).
+
* Sommige functies kunnen nog niet worden gebruikt in matrixformules: <tt>'''AANTAL.ALS'''</tt>, <tt>'''SOM.ALS'''</tt> ([http://qa.openoffice.org/issues/show_bug.cgi?id=65866 issue 65866]); <tt>'''VERGELIJKEN'''</tt> ([http://qa.openoffice.org/issues/show_bug.cgi?id=8947 issue 8947]); <tt>'''ISLOGISCH'''</tt> ([http://qa.openoffice.org/issues/show_bug.cgi?id=87219 issue 87219]).  
* <tt>'''OFFSET'''</tt> has limited behaviour within an array formula.
+
* <tt>'''VERSCHUIVING'''</tt> gedraagt zich beperkter binnen een matrixformule.
* Names defined by '''Insert - Names - Define''' can be used within an array formula, but labels (either '''Insert - Names - Labels''' or automatically recognised at the head of a column) should not be used ([http://qa.openoffice.org/issues/show_bug.cgi?id=87268 issue 87268]).
+
* Gedefinieerde namen via '''Invoegen - Namen - Definiëren''' kunnen worden gebruikt binnen een matrixformule, maar labels (ofwel via '''Invoegen - Namen - Labels''' of automatisch herkend boven een kolom) zouden niet moeten worden gebruikt ([http://qa.openoffice.org/issues/show_bug.cgi?id=87268 issue 87268]).
* In Excel, not all functions can be used in array formulas. For example <tt>'''CONCATENATE'''</tt> works in Calc but not in Excel. Be aware of Excel's limitations if you plan to use a Calc spreadsheet in Excel.
+
* In Excel kunen niet alle functies worden gebruikt in matrixformules. <tt>'''TEKST.SAMENVOEGEN'''</tt> werkt bijvoorbeeld in Calc wel maar niet in Excel. Wees u bewust van de beperkingen van Excel als u van plan bent om een werkblad van Calc te gebruiken in Excel.
* Volatile functions such as <tt>'''RAND'''</tt>, <tt>'''RANDBETWEEN'''</tt>, <tt>'''NOW'''</tt> may not be recalculated in array formulas; for example in <tt>'''{=A1:A3+RAND()}'''</tt> just one random number is generated ([http://qa.openoffice.org/issues/show_bug.cgi?id=67135 issue 67135]).
+
* Functies die snel wijzigen, zoals <tt>'''ASELECT'''</tt>, <tt>'''ASELECTTUSSEN'''</tt>, <tt>'''NU'''</tt> zouden niet opnieuw berekend kunnen worden in matrixformules; bijvoorbeeld in <tt>'''{=A1:A3+ASELECT()}'''</tt> wordt slechts één willekeurig getal gegenereerd ([http://qa.openoffice.org/issues/show_bug.cgi?id=67135 issue 67135]).
* Array formulas may slow down your computer if you have large arrays.
+
* Matrixformules kunnen de snelheid van uw computer vertragen als u grote matrices hebt.
 +
 
 +
 
 +
[[Category:Calc]]
 +
[[Category:NL/Documentation/How Tos]]

Revision as of 13:17, 30 November 2009

Introductie

Matrices kunnen handig zijn bij het reduceren van het aantal cellen dat u gebruikt, maar ze kunnen ietwat ingewikkeld te begrijpen zijn. Op sommige manieren kunnen zij de mogelijkheden van een werkblad uitbreiden tot voorbij het punt waarvoor werkbladen bedoeld waren. Bijna alle taken zijn mogelijk zonder hen.

Een matrix (array) is eenvoudigweg een rechthoekig blok van informatie dat Calc kan bewerken in een formule - dat betekent dat het informatie is die is georganiseerd in rijen en kolommen. Een matrix kan cellen zijn op een werkblad of intern door Calc worden behandeld.

Er zijn 2 manieren om een matrix in een formule te specificeren:

  • als een bereik - bijvoorbeeld A2:C3.
Calc array4.png
  • als een "matrix als regel", bijvoorbeeld {1; 5; 3 | 6; 2; 4} (deze zijn volledig functioneel vanaf OOo2.4, maar zij bestaan in eerdere versies - zie Matrix-problemen). U typt accolades { } rondom een matrix als regel. Items op een regel worden gescheiden door een punt-komma ‘;’, en rijen worden gescheiden door het teken pipe ‘|’. Elke rij moet hetzelfde aantal elementen hebben (het is niet juist om te schrijven {1; 2; 3 | 4; 5} omdat er 3 elementen in de bovenste rij staan en slechts 2 in de volgende rij). Matrices als regel mogen gemixte inhoud hebben, bijvoorbeeld {4; 2; "hond" | -22; "kat"; 0}. Een matrix als regel mag echter geen verwijzingen bevatten (bijv.: A4), of formules (bijv.: PI(), 2*3 ), of percentages (bijv.: 5%).


Calc array5.png

U kunt een naam geven aan een celbereik: selecteer het bereik en kies Invoegen - Namen - Definiëren.

U kunt een naam geven aan een matrix als regel: kies Invoegen - Namen - Definiëren; type de matrix (bijv.: {1; 3; 2} inclusief de accolades) in het vak Toegewezen aan.


Functies die matrices als parameters begrijpen

Sommige functies, zoals SOM(), GEMIDDELDE(), VERGELIJKEN() en ZOEKEN(), accepteren één of meer van hun parameters als matrices.

Bijvoorbeeld:

SOM( A2:C3 ) geeft de som terug van de getallen in het bereik A2:C3.
SOM( {3; 2; 4} ) geeft 9 terug, de som van de getallen in matrix als regel {3; 2; 4}.
SOM verwacht/begrijpt ook enkele (‘scalaire’) waarden - SOM( B5; 7 ) geeft de som terug van B5 en 7.

Functies die geen matrix als parameter verwachten

Sommige functies, zoals ABS(), WORTEL(), COS(), LENGTE() verwachten dat hun parameters ‘scalair’ zijn - dat betekent één enkele waarde zoals 354 of "hond" of de inhoud van een cel bijv.: B5.

Voorbeelden:

WORTEL(4) geeft 2 terug.
LENGTE("hond") geeft 4 terug.

U kunt echter nog steeds een matrix gebruiken waar één enkele waarde wordt verwacht - bijvoorbeeld WORTEL( {9; 4} ). Als u de formule invoert door ‘normaal’ op Enter te drukken, zal Calc de formule als volgt evalueren met behulp van één enkele waarde uit de matrix.

Als het een matrix als regel is:

Calc za; de eerste waarde gebruiken (die ‘linksboven’).
Voorbeeld:
=WORTEL( {9; 4 | 25; 16} ) drukken op Enter geeft 3 terug, de wortel van het eerste element in de matrix (9).

Als het een bereik is:

1. Calc zal een fout teruggeven, tenzij de matrix één enkele rij of één enkele kolom is.
2. Voor een bereik van één enkele rij of één enkele kolom zal Calc de waarde gebruiken van de cel waar de kolom/rij van de formule-cel kruist met de matrix (of een fout teruggeven als er geen kruising is).
Voorbeelden:
Calc array1.png
De formule =ABS(B2:B5) wordt 'normaal' ingevoerd in cel D3, dat is op rij 3. Rij 3 kruist B2:B5 bij cel B3, dus de geëvalueerde formule is =ABS(B3).
Calc array2.png
De formule =LENGTE(B5:D5) wordt 'normaal' ingevoerd in cel B1, dat is in kolom B. Kolom B kruist B5:D5 bij cel B5, dus de geëvalueerde formule is =LENGTE(B5).

Matrixformules

De echte kracht van matrices komt als u een formule op een speciale manier invoert, als een ‘matrixformule’. U doet dit door op Ctrl-Shift-Enter te drukken in plaats van op de toets Enter (of door het vakje Matrix te selecteren als u de Functie-assistent gebruikt).

Als u in cel B1 ‘normaal’ invoert ={3; 4} door op Enter te drukken, wordt de eerste waarde 3 weergegeven in de cel.

Als u in cel B2 invoert ={3; 4} maar drukt op Ctrl-Shift-Enter in plaats van op Enter, wordt de cel een 'matrixformule'. De formule geeft nu de gehele matrix {3; 4} terug. Cel B2 geeft 3 weer en cel C2 geeft 4 weer.

Let er op dat als u de formule invoerde door op de toets Enter te drukken, het eenvoudigweg selecteren van de cel en te drukken op Ctrl-Shift-Enter de cel niet zal converteren naar een matrix-expressie - u moet echt een bewerking uitvoeren (zoals een teken toevoegen of verwijderen), of op de Functie-assistent klikken en het vakje Matrix selecteren.

Als u nu probeert om de cel B2 te bewerken, krijgt u een melding dat "u geen deel van een matrix kunt bewerken". U moet de gehele matrix selecteren om die te bewerken, ofwel met de muis of door te typen Ctrl-/ (houd de Ctrl-toets ingedrukt en druk op de slash-toets ‘/’).

Calc array6.png


De formulebalk geeft aan dat dit een matrixformule is door die met accolades te omsluiten {}. U hoeft die niet te typen - zij zullen verdwijnen als u de formule bewerkt, en Calc zal ze opnieuw weergeven als u gereed bent met bewerken.

Berekeningen met matrixformules

Als Calc een matrixformule evalueert, behandelt het ‘onverwachte matrices’ als een serie van waarden (in plaats van één enkele waarde te gebruiken), berekent een resultaat voor elk van de matrix-elementen en geeft een resultaten-matrix weer.

Voorbeeld:

Calc array3.png
=WORTEL( {16; 4; 25} ) ingevoerd met het drukken op Ctrl-Shift-Enter in plaats van Enter geeft een resultaten-matrix weer, met 1 rij en 3 kolommen - {4; 2; 5}. Als de formule in cel B2 staat, plaatst Calc de resultaten in de cellen B2:D2. 4 wordt geplaatst in B2, 2 in C2 en 5 in D2.


Het uitgevoerde proces werkt aldus:

  1. Alle ‘onverwachte matrices’ in dezelfde matrix-berekening zouden dezelfde afmetingen moeten hebben (zie dit issue: Issue 46681).
  2. Het resultaat zal worden teruggegeven in een matrix van die afmeting.
  3. De berekening wordt, op zijn beurt, gedaan voor elk element, waarbij het resultaat wordt teruggegeven in het corresponderende element van de uitvoer-matrix.

Voorbeeld:

Met de matrixformule =WORTEL( {16; 4; 25} ):

  1. Er is slechts één matrix, met 1 rij en 3 kolommen.
  2. Het resultaat zal worden teruggeven in een matrix met 1 rij en 3 kolommen.
  3. De berekening wordt eerst gedaan voor 16, dan voor 4, dan voor 25, wat de resultaat-matrix {4; 2; 5} oplevert.

Voorbeeld:

Met de matrix-formule =WORTEL( {8 | 18} * 2 ) in cel A5:

  1. Er is slechts één matrix, met 2 rijen en 1 kolom.
  2. Het resultaat zal worden teruggeven in een matrix met 2 rijen en 1 kolom.
  3. De berekening is: eerste element WORTEL(8*2) = 4; tweede element WORTEL(18*2) = 6; de resultaat-matrix is dus {4 | 6} - dat betekent 4 in cel A5 en 6 in cel A6.

Het resultaat van een matrix-expressie is een matrix, die kan worden gebruikt binnen de formule.

Voorbeeld:

=SOM(WORTEL( {16; 4; 25} )) als een matrixformule. De berekening van WORTEL( {16; 4; 25} ), als hiervoor, levert als resultaat op {4; 2; 5}, dus geeft SOM( {4; 2; 5} ), levert als totaalresultaat in de cel op van 4+2+5 = 11.

Voorbeeld:

Met de matrixformule =SOM(ALS(A1:A4>0; B1:B4; 0))

  1. De twee matrices A1:A4 en B1:B4 hebben beide 4 rijen en 1 kolom.
  2. Het resultaat van de ALS()-matrixberekening zal een matrix zijn van die afmeting, die SOM() zal optellen.
  3. Als A1>0 het eerste element is B1; anders 0. Als A2>0 het tweede element is B2; anders 0 .... De aan SOM() gepresenteerde matrix heeft de waarden in B1:B4 waar de aanliggende waarde in A1:A4 is >0. De uiteindelijke uitvoer is de som van de waarden in B1:B4 waarvoor de aanliggende waarde in A1:A4 is >0.

Matrixfuncties

Sommige functies berekenen hun resultaten als een matrix. Als zij die matrix moeten teruggeven, moeten zij worden ingevoerd als een matrixformule, door te drukken op Ctrl-Shift-Enter (of door het vakje Matrix te selecteren als u de Functie-assistent gebruikt). Als zij, in plaats daarvan, zij 'normaal' worden ingevoerd met de Enter-toets, zal alleen het (enkele) element linksboven van de berekende matrix worden teruggegeven. Deze funties worden opgesomd in de categorie Matrixfuncties, en zijn:

INVERSEMAT, PRODUCTMAT, EENHEIDSMAT, TRANSPONEREN, INTERVAL, GROEI, LIJNSCH, LOGSCH, TREND


Bijvoorbeeld: =EENHEIDSMAT(2) ingevoerd als een matrixformule in cel B1 geeft de eenheid 2 x 2 (identiteit) matrix als de matrix {1; 0 | 0; 1} - dat betekent, cellen B1, B2, C1, C2 tonen 1, 0, 0, 1. Als deze formule 'normaal' wordt ingevoerd, wordt alleen de waarde van 'linksboven' (1) weergegeven in cel B1.


Sommige functies (inclusief enkele die hierboven zijn vermeld) accepteren parameters die worden gedwongen te evalueren als een matrixformule, zelfs als de formule 'normaal' wordt ingevoerd :

DETERMINANT.MAT, INVERSEMAT, PRODUCTMAT, SOMPRODUCT, SOM.X2MINY2, SOM.X2PLUSY2, SOM.XMINY.2, CORRELATIE, COVARIANTIE, VOORSPELLEN, F.TOETS, SNIJPUNT, MODUS, PEARSON, KANS, R.KWADRAAT, STIJGING, STFOUTYX, T.TOETS


Bijvoorbeeld: MODUS(ABS(A1:A3)) (in normale modus) forceeert dat ABS(A1:A3) wordt geëvalueerd als een matrixformule, die een matrix teruggeeft van de absolute waarden van A1:A3 van waaruit MODUS de meest algemene waarde selecteert om te worden teruggegeven.

Bijvoorbeeld: KANS(A1:A5; B1:B5/100; 3) (in normale modus) forceert dat B1:B5/100 wordt geëvalueerd als een matrixformule, die een matrix teruggeeft waarin elke waarde één honderdste van zijn waarde in B1:B5 is (misschien omdat de kansen werden uitgedrukt in procenten).


Een aantal van deze functies hebben enkele (matrix)-parameters die worden geforceerd om te worden geëvalueerd als een matrixformule, en andere (enkele waarde)-parameters die normaal evalueren.

Bijvoorbeeld: KANS(A1:A5; B1:B5; {3; 4}) (in normale modus) evalueert {3; 4} niet als een matrix, omdat dit zou betekenen dat KANS een matrix teruggeeft. Het evalueert KANS(A1:A5; B1:B5; 3) - dat betekent, het interpreteert {3; 4} in scalaire modus, door de waarde 'linksboven' 3 te nemen. Indien het echter wordt ingevoerd al;s een matrixformule, zal het natuurlijk een matrix teruggeven.

Tips en trucs

Al deze voorbeelden moeten worden ingevoerd als een matrix-expressie, door op Ctrl-Shift-Enter te drukken.

Som van items die overeenkomen met meerdere voorwaarden

SOM( (A1:A6="rood")*(B1:B6="groot")*C1:C6 ) geeft de som van de items in C1:C6 waarvan de items in kolom A zijn "rood" EN waarvan de items in kolom B zijn "groot". A1:A6 en B1:B6 maken elk een matrix van 6 elementen met WAAR of ONWAAR - die in het geval van berekeningen zijn: 1 of 0. Dus als A2 "rood" bevat en B2 bevat "groot" dan is het tweede element van de matrix 1 * 1 * C2 = C2. Als A2 in plaats daarvan "blauw" bevat, wordt het tweede element van de matrix 0 * 1 * C2 = 0.

SOM( (A1:A6="rood")+(B1:B6="groot")*C1:C6 ) geeft de som van de items in C1:C6 waarvan de items in kolom A zijn "rood" OF waarvan de items in kolom B "groot" zijn.

SOM(REST(A1:A6="rood")+(B1:B6="groot")*C1:C6 ) geeft ofwel de som van de items in C1:C6 waarvan de items in kolom A zijn "rood" of waarvan de items in kolom B "groot" zijn, maar niet beide (exclusieve OF)

SOM( NIET(A1:A6="rood")+(B1:B6="groot")*C1:C6 ) geeft de som van de items in C1:C6 waarvan de items in kolom A niet "rood" zijn NOCH waarvan de items in kolom B "groot" zijn.

Tellen van items die overeenkomen met meerdere voorwaarden

SOM( (A1:A6="rood")*(B1:B6="groot") ) geeft het aantal rijen terug waarvan de items in kolom A zijn "rood" EN waarvan de items in kolom B "groot" zijn.

Maximum in een bepaalde maand

MAX(ALS(MAAND(B1:B9)=5; C1:C9; 0)) geeft de maximale waarde terug in C1:C9 waarvan de overeenkomende datum in B1:B9 in Mei is (maand 5). De functie MIN() zou de minimale waarde van die maand teruggeven.

Gemiddelde van items die aan een voorwaarde voldoen

GEMIDDELDE(ALS(A1:A9="rood"; B1:B9; "")) geeft het gemiddelde terug van de items B1:B9 waarvan de items in kolom A “rood” zijn. De functie GEMIDDELDE negeert alle blanco items.

De functie MEDIAAN kan op dezelfde wijze worden gebruikt.

Dynamisch sorteren van een kolom

=GROOTSTE(B3:B9;RIJ(B3:B9)+1-RIJ(B3)) ingevoerd in cel C3 geeft een matrix terug in C3:C9 waarbij B3:B9 in aflopende volgorde staat. +1-RIJ(3) is een constante - u zou in plaats daarvan kunnen schrijven =GROOTSTE(B3:B9;RIJ(B3:B9)-2).

=KLEINSTE(B3:B9;RIJ(B3:B9)-2) geeft B3:B9 terug in oplopende volgorde.

Fouten negeren met SOM

SOM( ALS(ISFOUT(A1:A9); 0; A1:A9) ). Normaal gesproken zal SOM een gevonden fout vermelden.

Gemiddelde, blanco items negeren

GEMIDDELDE(ALS(B1:B9<>0; B1:B9; ""))

Een cel testen op een verzameling waarden

OF(B2={2; 5; 6}) als een matrix-expressie, of OF(B2=2; B2=5; B2=6) als een ‘normale’ formule.

Som van de 4 kleinste getallen

SOM(KLEINSTE(B3:B9; {1;2;3;4})) of SOM(KLEINSTE(B3:B9;RIJ(A1:A4))). RIJ(A1:A4) produceert {1;2;3;4}.

Laatste gebruikte cel in een kolom

MAX(RIJ(B1:B9)*(B1:B9<>"")) geeft het rijnummer terug van de laatste gebruikte cel.

Problemen

  • "Matrices als regel" werken in OOo2.3, maar falen als er spaties zijn of negatieve getallen. Dit is opgelost voor OOo2.4, hoewel spaties worden verwijderd in plaats van genegeerd (issue 82644).
  • Het zal mogelijk zijn om matrices van verschillende afmetingen op te nemen in een formule, omdat er een gedefinieerd berekeningsproces bestaat in de aanstaande internationale standaard ODFF. Calc zou daar in OOo3.0 aan moeten voldoen (issue 46681).
  • Sommige functies kunnen nog niet worden gebruikt in matrixformules: AANTAL.ALS, SOM.ALS (issue 65866); VERGELIJKEN (issue 8947); ISLOGISCH (issue 87219).
  • VERSCHUIVING gedraagt zich beperkter binnen een matrixformule.
  • Gedefinieerde namen via Invoegen - Namen - Definiëren kunnen worden gebruikt binnen een matrixformule, maar labels (ofwel via Invoegen - Namen - Labels of automatisch herkend boven een kolom) zouden niet moeten worden gebruikt (issue 87268).
  • In Excel kunen niet alle functies worden gebruikt in matrixformules. TEKST.SAMENVOEGEN werkt bijvoorbeeld in Calc wel maar niet in Excel. Wees u bewust van de beperkingen van Excel als u van plan bent om een werkblad van Calc te gebruiken in Excel.
  • Functies die snel wijzigen, zoals ASELECT, ASELECTTUSSEN, NU zouden niet opnieuw berekend kunnen worden in matrixformules; bijvoorbeeld in {=A1:A3+ASELECT()} wordt slechts één willekeurig getal gegenereerd (issue 67135).
  • Matrixformules kunnen de snelheid van uw computer vertragen als u grote matrices hebt.
Personal tools