File: data-types.xml

package info (click to toggle)
gnumeric 1.12.57-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 111,496 kB
  • sloc: ansic: 296,601; xml: 56,363; perl: 6,615; sh: 5,288; makefile: 2,981; yacc: 1,341; python: 389
file content (981 lines) | stat: -rw-r--r-- 34,201 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
<sect1 id="sect-data-types">
  <title>The Types of Cell Elements</title>
  
  <para>
    Each cell in a &gnum; worksheet can
    contain only a single data element. These elements will have one
    of five basic types: text, numbers, booleans, formulas, or
    errors. During data entry, &gnum;
    assigns a default data type to the cell based on an analysis of
    the cell contents. This assignment can be changed later if
    &gnum; makes the wrong
    assignment. For information on how to change the data type of a
    cell, see <xref linkend="sect-data-format" />.
  </para>

  <para>
    The five basic types of data which can be stored in a spreadsheet
    cell are:
    <variablelist>

       <varlistentry>
         <term>Text</term>
         <listitem>
           <para>
              A text element can contain a series of letters, numbers
              or other contents. For example, the first cell in a
              worksheet might contain the characters &mdash;This
              worksheet describes the company's income &mdash; which
              &gnum; would interpret to
              be text. In order to distinguish text elements from
              number or formula elements, the text element may start
              with a single quote. For instance, if a cell contained
              only the three digits 345,
              &gnum; would consider that
              to be the number three hundred and forty five. If this
              cell is intended to be a string,
              &gnum; will store the cell
              as '345. The newline character cannot be entered
              directly but must be entered as <keycombo>
              <keycap>Alt</keycap>
              <keycap>Enter</keycap></keycombo>. For more information
              on entering and formatting text elements, see <xref
              linkend="sect-data-text" />.
            </para>
          </listitem>
        </varlistentry>

        <varlistentry>
         <term>Numbers</term>
         <listitem>
           <para>
              A number element can contain a series of digits (425)
              but may include specific text and formatting characters
              to indicate negative numbers (-345), decimal separator
              (34.0567), thousand separators (12,342), currency ($23),
              dates (21-10-1998), times (10:23) or scientific notation
              (2.3e12). Dates may include the names of months or their
              abbreviation. The currency, decimal separator and
              thousands separator symbols vary depending on the locale
              (the language and other location specific behaviour) to
              which &gnum; has been
              set. See <xref linkend="sect-configuration-localization"
              /> to understand how to change the locale. If you want a
              number to be displayed as a plain string without any
              number formatting, you can put a single quote (') before
              it. For more information on entering and formatting,
              numeric elements see <xref
              linkend="sect-data-numbers"/>.
            </para>
          </listitem>
        </varlistentry>


       <varlistentry>
         <term>Boolean</term>
         <listitem>
           <para>
              A boolean element can contain one of two values: TRUE
              and FALSE. These are useful as inputs or outputs from
              formulas and for boolean algebra.  More information on
              boolean data elements is presented in <xref
              linkend="sect-data-boolean" />.
            </para>
          </listitem>
        </varlistentry>


       <varlistentry>
         <term>Formulas</term>
         <listitem>
           <para>
             A formula is an instruction to
             &gnum; which describes a
             calculation which should be performed
             automatically. These formulas can contain standard
             arithmetic elements but can also contain references to
             other cells. Calculations which depend on other cells are
             usually recalculated when the values of another cell
             changes. Formulas always begin with a special character
             &mdash; the equals sign (=). The commercial at symbol (@)
             can be used instead of the equals sign during data entry
             but &gnum; will convert this
             to an equals sign. Alternatively, an entry which
             describes a calculation and which starts with either the
             plus (+) or minus symbol (-) will be converted to a
             formula starting with an equals sign. For a more complete
             explanation of formulas, see <xref
             linkend="sect-data-formulas" />.
            </para>

           <para>
           A cell reference is the part of a formula which refers to
           another cell.  For example, in the formula to add two cells
           =(A4+A1), both A4 and A1 are cell references. These
           references can be quite complex referring to cells in
           different worksheets or even in different files. See <xref
           linkend="sect-data-formulas-references" /> for a complete
           explanation of references.
            </para>
 
          </listitem>
        </varlistentry>


       <varlistentry>
         <term>Error</term>
         <listitem>
           <para>
              An error element describes the failure to calculate the
              result of a formula. These values are rarely entered
              directly by a user but usually are the display given
              when a formula cannot be correctly calculated.  See
              <xref linkend="sect-data-errors" /> for a complete list
              of error values and their explanation.
            </para>
          </listitem>
        </varlistentry>

    </variablelist>
  </para>

  <note>
    <para>
      A cell may display a series of hash marks (######). This
      indicates that the result is too wide to display in the cell
      given the current font setting and the current column
      width. When this occurs, the value in the cell can be seen in
      two ways. If the cell is selected, the value will appear in the
      data entry area (to the right of the equals button directly
      above the cell grid). Alternatively, the column containing the
      cell can be widened until the data contents become visible:
      select the whole column (by clicking on the column header)
      and choose 
      <menuchoice>
      <guimenu>Format</guimenu>
      <guisubmenu>Column</guisubmenu>
      <guimenuitem>Auto fit selection</guimenuitem>
      </menuchoice>.
    </para>
  </note>


<sect2 id="sect-data-text">
  <title>Text Data Elements</title>

  <para>
    Text elements consist of an arbitrary sequence of characters or
    numbers entered into a cell. Because
    &gnum; automatically recognizes
    certain sequences as numbers or formulas, certain sequences of
    characters (such as sequences containing only digits or a text
    element which starts with an equals sign) must be treated
    specially to have them considered text. In order to force any
    sequence to be considered text, the sequence can be started with
    an apostrophe symbol (<keysym>'</keysym>). Alternatively, the
    'number' format of the cell can be specified to be 'text' before
    entering the characters, as explained in <xref
    linkend="number-formatting-overview"/>. Text elements are the
    simplest elements to enter into spreadsheet cells.
  </para>

  <para> An example of a spreadsheet cell grid with cells containing
  text is given in <xref linkend="fig-cell-with-text" />.

  <figure id="fig-cell-with-text">
    <title>A Text Data Element in a Cell.</title>
    <mediaobject>
      <imageobject>
	<imagedata fileref="figures/cell-with-text.png" format="PNG" />
      </imageobject>
    </mediaobject>
  </figure>

  </para>

  <para>
    Valid text entries include simple words, whole sentences and even
    paragraphs.
  </para>

  <note>
    <para>
      To include a newline in a cell, a special key combination is
      required. A newline symbol can be inserted with the key
      combination of
      <keycombo><keysym>Alt</keysym><keysym>Enter</keysym></keycombo>.
    </para>
  </note>


</sect2>	  

<sect2 id="sect-data-numbers">
  <title>Number Data Elements</title>

<!-- TODO: add influence of locale (decimal, thousands sep) on number format. -->

  <para>
    Number data elements include a variety of data all of which are
    stored and manipulated by &gnum; as
    numbers. This includes integers, decimal fractions, general
    fractions, numbers in scientific notation, dates, times, and
    currency values.
  </para>

  <para>
    Data are recognized as numbers when they are entered, dependent on
    the format of the sequence of characters
    entered. &gnum; attempts to
    intelligently guess the subtype of the data and match the data to
    an existing format for numbered data. If it matches a data format,
    &gnum; will automatically assign the
    datum to a data type and associate an appropriate display format
    with the cell. The format recognition of
    &gnum; includes a wide variety of
    data formats which are discussed in detail in <xref
    linkend="number-formatting-overview" />.
  </para>

  <para>
    Because &gnum; automatically guesses
    the data type of a number being entered into a cell, this process
    may have to be over-ridden for certain types of data. For
    example, postal codes in the United States consist of a sequence
    of numbers which &gnum; interprets as
    an integer. However, U.S. postal codes can start with a leading
    zero which &gnum; discards by
    default. In order to override the default format, the number
    format of the cell must be specified before the entry of the
    data. This is explained in <xref
    linkend="number-formatting-overview" />, below.
  </para>


</sect2>	  

<sect2 id="sect-data-boolean">
  <title>Boolean Data Elements</title>
  
  <para>
    Cells can contain boolean data elements. These elements arise from
    Boolean logic which is a branch of mathematics. These elements are
    useful for manipulation of formulas.
  </para>

  <para>
    Boolean values can be either "TRUE" or "FALSE". If these strings
    are entered into a cell, &gnum; will
    recognize these as boolean values. These values can then be used
    in formulas. Certain formulas will also return boolean values.
  </para>

<!--
  <example>
    <para>
      An example of a formula expression which uses booleans and
      returns a boolean value:
      <programlisting>
        =

      </programlisting>
    </para>
  </example>
-->


</sect2>	  





<sect2 id="sect-data-formulas">
  <title>Formula Elements</title>
  
<!-- TODO: add explanation of operator precedence. -->
<!-- TODO: add explanation of stacked division a/b/c. -->

  <para>
    Formulas are the key to making a powerful spreadsheet. A formula
    instructs &gnum; to perform
    calculations and display the results. These calculations are
    defined as a formula data elements. The power of these formulas
    arises because these formulas can include the contents of other
    cells and the results of the formulas are updated automatically
    when the contents of any cell included in the formula change. The
    contents of other cells are included using "cell references" which
    are explained below.
  </para>

  <para>
    Any formula entered into a cell must follow a specific syntax so
    that &gnum; can interpret the formula
    correctly. This syntax closely follows mathematical notation but
    also includes spreadsheet formulas, object names and cell
    references.
  </para>
    
  <sect3 id="sect-data-formulas-syntax">
    <title>Syntax</title>
    
    <para>
      Formulas are distinguished from regular data by starting with an
      equals sign (=) as the first character. Everything following
      this equals sign is evaluated as a formula.
    </para>

    <tip>
      <title>Alternate Beginnings for Formulas</title>

      <para>
        To accommodate those more familiar with Lotus spreadsheets,
        Gnumeric recognizes the commercial at symbol (@) as the
        beginning of a formula and substitutes an equals sign.  The
        plus and minus characters (+ and -) may also start formulas
        that involve calculation, but when used in front of a single
        number only indicate the sign of the number.
      </para>
    </tip>

    <para>
      The simplest formulas just use the standard math operator and
      symbols.  Addition, subtraction, multiplication, and division
      are represented by +, -, *, and /, just as you would expect.
      +,- can be placed in front of numbers to indicate sign, as well.
      
      <example id="standardoperators">
        <title>Examples of standard operators</title>
        <programlisting>
=5+5            returns 10.
	
=5-4            returns 1.
	
=-5             returns -5.
	
=5*5            returns 25.

=(5*5)+11       returns 36.
	
=(5*5)+(49/7)   returns 32.
        </programlisting>
      </example>
    </para>

    <para>
      Formulas can result in error values in several instances. If a
      formula is entered incorrectly,
      &gnum; will display a warning and
      allow either the formula to be corrected or will save the
      formula as text for editing later. If a syntactically correct
      formula results in a nonsensical calculation (for instance, a
      division by zero), then an error value will be displayed
      indicating the error.
    </para>

  </sect3>



  <sect3 id="sect-data-formulas-functions">
    <title>Using Functions</title>
    
    <para>
      Formulas can also contain functions which denote the use of
      standard mathematical, business, statistical, and scientific
      calculations. These functions take the place of any data element
      in a formula and can therefore be combined with the standard
      arithmetic operators described above.
    </para>

    <para>
      These functions have the form:
    
      <example id="basicfunctionsyntax">
        <title>Basic Function syntax</title>
        <programlisting>
FUNCTIONNAME(ARGUMENTS)
        </programlisting>
      </example>

      where FUNCTIONNAME indicates the name of a function and
      ARGUMENTS indicates one or more arguments to the function. The
      function arguments are separated by commas (<keysym>,</keysym>).

    </para>

    <tip>
      <para>
        While the documentation generally refers to functions and to
        cells in capital letters, their use is not actually case
        sensitive.
      </para>
    </tip>

    <para>
      Some examples of the use of functions are: 

	<example id="functionsyntax">
	  <title>Some examples of function syntax</title>
	  <programlisting>
=SUM(A1,A2,A4,B5)
	    
=AVERAGE(A1:A16)
	    
=EXP(1)
	    
=PI()
	    
=3+4*MIN(A1,A2,B6)
	  </programlisting>
	</example>

      The arguments of the functions vary in number from none, as in
      the PI() function, to an unlimited number, as in the SUM()
      function, depending on the type of function.
    </para>

  </sect3>



  <sect3 id="sect-data-formulas-references">
    <title>Cell Referencing</title>

    <para>
      Formulas can include the displayed data from other cells. These
      contents are described as `cell references' which are names
      indicating that the contents of other cells should be used in
      the calculation.
    </para>

    <para>
      Each cell in a spreadsheet is named by its column and row
      labels. By default, the column labels are letters and the row labels are
      numbers. The first cell, therefore, is called A1. One column
      over and two rows down from cell A1 is the cell B3.
      In a worksheet of the default size, the right
      most and bottom most cell is cell IV65536 which is the cell in
      column IV and in row 65536.
      An alternative cell reference notation uses numbers for both row
      and column identification.
      See <xref linkend="sect-data-formulas-references-r1c1" /> below for details.
    </para>

    <para>
      The value of a cell can be used in a formula simply by entering
      its name where a number value would otherwise occur. For
      example, to have the data in cell B1 appear in another cell,
      enter =B1 into that cell. Other more complex examples include:
  
      <example id="simplecellrefer">
        <title>Some examples of simple cell reference syntax</title>

        <programlisting>
=A1+EXP(B1)-(C3/C4)
      
=COS(A2)*SIN(A2)
        </programlisting>
      </example>
    </para>
  
    <sect4 id="sect-data-formulas-references-absolute">
      <title>Absolute cell referencing</title>

      <para>
        Cells can be referenced in the default way (relative
        referencing), or by using absolute referencing. Absolute
        referencing means that when the cell is copied, the cell
        reference does not change. Normally, auto-filling a cell range
        or moving a cell will change its cell reference so that it
        maintains a relation to the original cell. Absolute
        referencing prevents these changes.
      </para>

      <tip id="why-bother">
        <title>When Does Relative Referencing Make a Difference?</title>
        <para>
          The difference between absolute and relative cell references
          only matters if you are copying or moving cells that contain
          cell references. For cells that are going to remain in
          place, both the relative and absolute references have the
          same result.
        </para>
      </tip>

      <example id="relative-referencing-explained">
        <title>Relative References</title>
          <para>
            For example, if =A1 is the formula entered into cell B2,
            cell B2 will display the data in cell A1, which is one row
            up and one column left.  Then, if you copy the contents of
            B2 to cell F6, cell F6 will contain the value from E5,
            which is also one row up and one column left.
          </para>

          <para>
            For the copied cell to still refer to A1, specify absolute
            references using the $ character: $A$1 refers to cell A1,
            no matter where it is copied.
          </para>
        </example>

      <para>
        The format for absolute cell referencing is to use a '$' in
        front of the cell coordinate that you want to stay
        constant. The column, the row, or both can be held constant.
      </para>

      <example id="cell-refer-absolute-reference">
        <title>Cell referencing examples</title>

        <para>
          What happens when a given formula is entered into cell B2,
          then copied to other cells?
	<variablelist>
	  <varlistentry>
	    <term>=A1</term> 
            <listitem>
              <para>
                =A1 is a normal, or relative, cell reference
                function. When =A1 is entered into cell B2, it refers
                to the value of data one cell up and one cell left
                from the cell with the reference. Therefore, if this
                formula were copied from cell B2 to cell C2, the value
                displayed in cell C2 will be the value of data in cell
                B1.  Copied to cell R19, the formula will display the
                data in cell Q18.
              </para>
            </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>=$A1</term>
            <listitem>
              <para>
                In this case, the column value is absolute, but the
                row value is relative.  Therefore, if =$A1 is entered
                into cell B2, the formula refers to the data in column
                A that is one row up from the current location.
                Copied to cell C2, the formula will refer to the data
                in cell A1. Copied to cell R19, it will refer to the
                data in A18.
              </para>
            </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>=A$1</term>
            <listitem>
              <para>
                This formula uses a relative column value and an
                absolute row value. In cell B2, it refers to cell A1
                as the data in the cell one column left and in row
                1. Copied to cell C3, the formula will display the
                data in cell B1.
              </para>
            </listitem>
	  </varlistentry>

	  <varlistentry>
	    <term>=$A$1</term>
            <listitem>
              <para>
                No matter where this formula is copied, it will always
                refer to the data in cell A1.
              </para>
            </listitem>
	  </varlistentry>
	</variablelist>
        </para>
      </example>
    </sect4>

    <sect4 id="sect-data-formulas-references-r1c1">
    <title>References using R1C1 Notation</title>
      <para>
        From the <guimenuitem>Format &#9654; Sheet</guimenuitem> submenu you can
        select R1C1 notation for a worksheet.
        This causes all cell references on the sheet to be shown as
        &ldquo;R<emphasis role="italic">r</emphasis>C<emphasis role="italic">c</emphasis>&rdquo;,
        where <emphasis role="italic">r</emphasis> is the row number and
        <emphasis role="italic">c</emphasis> is the column number.
        When R1C1 notation is selected, the column headers show numbers rather than letters.
      </para>
      <para>
        When <emphasis role="italic">r</emphasis> and <emphasis role="italic">c</emphasis>
        are positive integers, as in &ldquo;R1C1&rdquo;, the reference is absolute.
        To produce a relative reference, enclose a number in square brackets; if the number
        is zero, it can be omitted along with the brackets.
        For example, &ldquo;RC[-2]&rdquo; refers to the cell two columns to the left
        in the current row, while &ldquo;R[1]C1&rdquo; refers to the cell in the first
        column of the next row down from the referencing cell.
        The second example combines a relative row reference with an absolute column reference.
      </para>
    </sect4>

    <sect4 id="sect-data-formulas-references-multi">
      <title>Referencing multiple cells</title>
    
      <para>
        Many functions can take multiple cells as arguments. This can
        either be a comma separated list, an array, or any combination
        thereof.
      </para>
    
      <sect5 id="sect-data-formulas-references-multi-indiv">
        <title>Multiple individual cells</title>
      
        <para>
          A comma separated list of cell references can be used to
          indicate cells that are discontinuous.
        </para>
      
      
        <example id="cellrefermutiplecells">
	  <title>Some examples of function syntax</title>
	  <programlisting>
=SUM(A1,B2,C4)
	  
=MIN(A1,B2,C4,C5,D6)
	  </programlisting>
        </example>
      
      
        <screenshot>
	  <mediaobject>
            <imageobject>
              <imagedata fileref="figures/cells-1.png" format="PNG" />
            </imageobject>
            <textobject>
              <phrase>An image of a worksheet with a function.</phrase>
            </textobject>
           </mediaobject>
        </screenshot>

      </sect5>
    
      <sect5 id="sect-data-formulas-references-multi-region">
        <title>Referencing a continuous region of cells</title>
      
        <para>
          For functions that take more than one argument, it is often
          easier to reference the cells as a group. This can include
          cells in sets horizontally, vertically, or in arrays.
        </para>
      
        <para>
          The ':' operator is used to indicate a range of cells. The
          basic syntax is upper left corner:bottom right
          corner.
        </para>
      
        <example id="cellrefercontin">
	  <title>Referencing blocks of cells</title>
	  <programlisting>
=SUM(A1:E1)
	  
=AVERAGE(B4:E7)
	  
=MIN(A1:A5)            
	  </programlisting>
        </example>
      
      
        <screenshot>
	  <mediaobject>
            <imageobject>
              <imagedata fileref="figures/cells-2.png" format="PNG" />
            </imageobject>
            <textobject>
              <phrase>An image of a worksheet with a function
              referencing a block of cells.</phrase>
            </textobject>
           </mediaobject>
        </screenshot>
      </sect5>
    
      <sect5 id="sect-data-formulas-references-multi-disjoint">
        <title>Referencing non-continuous regions</title>
	  
        <para>
          For referencing cells that are in non-continuous regions,
          you can use any combination of the above methods to get the
          needed cells.
        </para>
      
      
	<example id="cellreferdiscontin">
	  <title>Referencing blocks of cells</title>
	  <programlisting>
=SUM(A1:E1, B19, L14:L17)
	  
=AVERAGE(A1,A3, A5:C5)
	  </programlisting>
        </example>
      </sect5>
    </sect4>

    <sect4 id="sect-data-formulas-references-tosheets">
      <title>Referencing cells on other sheets</title>

      <para>
        It is possible to reference cells which are not part of the
        current sheet.  This is done using the SHEETNAME!CELLLIST
        syntax, where SHEETNAME is an identifier (usually a sheet
        name) and CELLLIST is a reference to a cell or range of cells as described in
        the previous sections.
        If SHEETNAME contains spaces or other special characters, you must
        quote the whole name to allow &gnum; to recognize it as a single name.
        See the examples below.
      </para>

      <para>
        When the reference is to a range of cells, the worksheet name only
        needs to be given with the first cell reference. The ending cell of
        the range is assumed to be on the same worksheet if an explicit sheet
        name is not specified. Note, however, that &ldquo;Sheet1!A1:Sheet3!C5&rdquo;
        is a legitimate cell range description. It identifies a range three columns
        wide and five rows deep on each of the worksheets from Sheet1 through Sheet3.
        The preferred form of such a reference is &ldquo;Sheet1:Sheet3!A1:C5&rdquo;,
        which is the form &gnum; will display if you subsequently edit the contents
        of a cell containing such a reference.
      </para>

      <example id="simple-sheet-ref">
        <title>Referencing cells in other sheets</title>
        <programlisting>
='Sheet 0'!A1+'Sheet 3'!A5

=SUM(Sheet1!A1:A5)
        </programlisting>
      </example>

    </sect4>

    <sect4 id="sect-data-formulas-references-tofiles">
      <title>Referencing cells on other files</title>

      <para>
        It is possible to reference cells in other files. The
        canonical form for these references is
        [<emphasis role="italic">filename</emphasis>]SHEETNAME!CELLLIST.
        The square brackets serve to quote <emphasis role="italic">filename</emphasis>,
        so you should use quotation marks only if they are actually part of the file name.
        Note that the sheet name must be present in references of this form.
      </para>

      <example id="simple-file-ref">
        <title>Referencing cells in other files</title>
        <programlisting>
=[Name of the file]'Sheet 0'!A1

=CEIL( [First Version.gnumeric]'Sheet 1'!E20 )
        </programlisting>
      </example>

    </sect4>


  </sect3>



  <sect3 id="sect-data-formulas-names">
    <title>Names</title>

    <para>
      Names are labels which have a meaning defined in the spreadsheet or by &gnum;.
      A name can refer to a numeric value, a string, a range of cells, or a formula.
      For details on defining and using names, see <xref linkend="sect-data-names" />.
    </para>

    <example id="namesyntax">
      <title>Examples of name usage</title>

      <para>
        If myCellRange is defined as '$A$1:$B$500' and my_E_Constant is
        defined as 2.71828182845 then we can have:
      </para>

      <programlisting>
=VLOOKUP(C1, "gnu", myCellRange, 2, 0)

=LN(my_E_Constant)

=SUM(myCellRange, my_E_Constant)
      </programlisting>
    </example>

  </sect3>

  <sect3 id="sect-data-formulas-array">
    <title>Array Formulas</title>
    
    <para>
      It is periodically useful or necessary to have an expression
      return a matrix rather than a single value.  The first example
      most people think of are matrix operations such as
      multiplication, transpose, and inverse.  A less obvious usage is
      for data retrieval routines (databases, realtime data-feeds) or
      functions with vector results (yield curve calculations).
    </para>
    
    <example id="arrayformulacreate">
      <title>Entering an Array Formula</title>
      <para>
        An array formula is currently entered by selecting the single
        range in which to store the result, entering the array
        formula, and hitting the key combination,
        <keycombo>
          <keycap>Ctrl</keycap>
          <keycap>Shift</keycap>
          <keycap>Enter</keycap>
        </keycombo>.
      </para>

      <para>
        The result is displayed as:
      </para>

      <programlisting>
={FUNCTION(ARGUMENTS)}(num_rows, num_cols)[row][column]
      </programlisting>
    </example>

  </sect3>

  <sect3 id="sect-data-formulas-database">
    <title>Database Formulas</title>
  <para>
    Solely for compatibility with Excel and ODF files, &gnum; supports various database functions:
    <xref linkend="gnumeric-function-DAVERAGE" />,
    <xref linkend="gnumeric-function-DCOUNT" />,
    <xref linkend="gnumeric-function-DCOUNTA" />,
    <xref linkend="gnumeric-function-DGET" />,
    <xref linkend="gnumeric-function-DMAX" />,
    <xref linkend="gnumeric-function-DMIN" />,
    <xref linkend="gnumeric-function-DPRODUCT" />,
    <xref linkend="gnumeric-function-DSTDEV" />,
    <xref linkend="gnumeric-function-DSTDEVP" />,
    <xref linkend="gnumeric-function-DSUM" />,
    <xref linkend="gnumeric-function-DVAR" /> and
    <xref linkend="gnumeric-function-DVARP" />.
  </para>
  <para>
    Since these functions are quite restrictive on the criteria that can be used, it is often
    easier to use array functions as described in <xref linkend="sect-data-formulas-array" />.
    Array functions are also useful in the case that a specific database function does not exist:
  </para>

 <example id="dmedian">
   <title>Simulating <code>DMEDIAN</code> with an Array Function</title>
   <para>
     As shown in  <xref linkend="dmedian-example-1" />, instead of using (the non-existing) 
     function <code>DMEDIAN</code> one can use the alternative expression 
     <code>median(if(A1:A20="AA",B1:B20))</code> entered as an array function as described in 
     <xref linkend="sect-data-formulas-array" />. Multiple conditions can be combined using
     multiplication to obtain <code>AND</code> and addition to obtain <code>OR</code> as in 
     <code>median(if((A1:A20="AA")+(C1:C20="BB"),B1:B20))</code>.
     Using defined names as introduced in <xref linkend="sect-data-formulas-names" /> for 
     <code>A1:A20</code> and <code>B1:B20</code> can make this code very flexible and readable.
   </para>
 </example>
     <note><para>
     In this case we cannot use <code>if(OR(A1:A20="AA",C1:C20="BB"),...)</code> since the
     OR function would be applied to all 40 equality tests rather than each of the 20 pairs of equality tests.
   </para></note>

  <figure id="dmedian-example-1">
    <title>Calculating the MEDIAN of Some Data Values</title>
    <screenshot>
	<mediaobject>
            <imageobject>
              <imagedata fileref="figures/formula-dmedian.png" 
                  format="PNG" />
            </imageobject>
            <textobject>
              <phrase>Calculating the MEDIAN of some data values.</phrase>
            </textobject>
           </mediaobject>
    </screenshot>
  </figure>

 </sect3>

</sect2>
             




<sect2 id="sect-data-errors">
  <title>Error Elements</title>
  
  <para>
    Cells can display error values if the formula contained in the
    cell cannot be solved or if other anomalous conditions occur. 
  </para>
  <para>
    In &gnum; all error values have names that start with <code>#</code>. 
    8 error values are standardized:
  </para>
<!--    TABLE    TABLE    TABLE    TABLE    TABLE    TABLE    -->
<table frame='all'><title>The standard error values of &gnum;</title>
<tgroup cols='2' align='left' colsep='1' rowsep='1'>
<colspec colnum="1" colname="col1" colwidth="1*"/>
<colspec colnum="2" colname="col2" colwidth="3*"/>
<thead>
<row>
  <entry align="left">Name</entry>
  <entry align="center">Normal Use</entry>
</row>
</thead>
<tbody>
<row>
  <entry><code>#DIV/0!</code></entry>
  <entry>Division by zero occurred.</entry> 
</row>
<row>
  <entry><code>#N/A</code></entry>
  <entry>Not applicable. This is the result of the 
  <code>=NA()</code> formula.
  </entry> 
</row>
<row>
  <entry><code>#NAME?</code></entry>
  <entry>An unknown function name or other name was encountered.</entry> 
</row>
<row>
  <entry><code>#NULL!</code></entry>
  <entry>The result of specifying an intersecting range that in fact does
  <emphasis>not</emphasis> intersect.</entry> 
</row>
<row>
  <entry><code>#NUM!</code></entry>
  <entry>A formula could not be evaluated because an invalid number was 
  used as argument, for example <code>=SQRT(-1)</code></entry> 
</row>
<row>
  <entry><code>#REF!</code></entry>
  <entry>An invalid cell address or reference was encountered.</entry> 
</row>
<row>
  <entry><code>#UNKNOWN!</code></entry>
  <entry>Usually the result of importing an unrecognized error from a
  different file format.</entry> 
</row>
<row>
  <entry><code>#VALUE!</code></entry>
  <entry>A formula could not be evaluated because the wrong type of argument
  was used.</entry> 
</row>
</tbody>
</tgroup>
</table>
<!--    TABLE    TABLE    TABLE    TABLE    TABLE    TABLE    -->

</sect2>


</sect1>