<?xml version="1.0" encoding="UTF-8"?>
<helpdocument version="1.0">

<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->


<meta>
      <topic id="textscalcguidecellreferencesxml" indexer="include" status="PUBLISH">
         <title id="tit">Referencing a Cell in Another Sheet</title>
         <filename>/text/scalc/guide/cellreferences.xhp</filename>
      </topic>
   </meta>
   <body>
<bookmark branch="index" id="bm_id3147436"><bookmark_value>sheet references</bookmark_value>
      <bookmark_value>references; to cells in other sheets/documents</bookmark_value>
      <bookmark_value>addresses; to cells in other sheets/documents</bookmark_value>
      <bookmark_value>cells; operating in another document</bookmark_value>
      <bookmark_value>documents;references</bookmark_value>
      <bookmark_value>cell;address</bookmark_value>
      <bookmark_value>address; of cell</bookmark_value>
</bookmark>
<comment>mw made "sheet references;" a one level entry</comment><comment>MW changed "references;" and added "documents;"</comment>
<h1 id="hd_id3147436"><variable id="cellreferences"><link href="text/scalc/guide/cellreferences.xhp">Referencing a Cell in Another Sheet</link>
</variable></h1>
      <paragraph id="par_id9663075" role="paragraph">In a sheet cell you can show a reference to a cell in another sheet.</paragraph>
      <paragraph id="par_id1879329" role="paragraph">In the same way, a reference can also be made to a cell from another document provided that this document has already been saved as a file.</paragraph>
      <h2 id="hd_id7122409">To Reference a Cell in the Same Document</h2>
      <list type="ordered">
         <listitem>
            <paragraph id="par_id2078005" role="listitem">Open a new, empty spreadsheet. By default, it has only a single sheet named Sheet1. Add a second sheet clicking on <emph>+</emph> button to the left of the sheet tab in the bottom (it will be named Sheet2 by default).</paragraph>
         </listitem>
         <listitem>
            <paragraph id="par_id4943693" role="listitem">By way of example, enter the following formula in cell A1 of Sheet1:</paragraph>
            <paragraph id="par_id9064302" role="listitem">
               <item type="literal">=Sheet2.A1</item>
            </paragraph>
         </listitem>
         <listitem>
            <paragraph id="par_id7609790" role="listitem">Click the <emph>Sheet 2</emph> tab at the bottom of the spreadsheet. Set the cursor in cell A1 there and enter text or a number.</paragraph>
         </listitem>
         <listitem>
            <paragraph id="par_id809961" role="listitem">If you switch back to Sheet1, you will see the same content in cell A1 there. If the contents of Sheet2.A1 change, then the contents of Sheet1.A1 also change.</paragraph>
         </listitem>
      </list>
      <tip id="par_id3147338">When referencing a sheet with name containing spaces, use single quotes around the name: <item type="literal">='Sheet with spaces in name'.A1</item></tip>
      <tip id="par_id3147383">The example uses Calc formula syntax. It is also possible to use Excel A1 or R1C1 formula syntax; this is configured on <link href="text/shared/optionen/01060900.xhp">Formula options page</link>.</tip>
      <h2 id="hd_id9209570">To Reference a Cell in Another Document</h2>
      <list type="ordered">
         <listitem>
            <paragraph id="par_id5949278" role="listitem">Choose <emph>File - Open</emph>, to load an existing spreadsheet document.</paragraph>
         </listitem>
         <listitem>
            <paragraph id="par_id8001953" role="listitem">Choose <emph>File - New</emph>, to open a new spreadsheet document. Set the cursor in the cell where you want to insert the external data and enter an equals sign to indicate that you want to begin a formula.</paragraph>
         </listitem>
         <listitem>
            <paragraph id="par_id8571123" role="listitem">Now switch to the document you have just loaded. Click the cell with the data that you want to insert in the new document.</paragraph>
         </listitem>
         <listitem>
            <paragraph id="par_id8261665" role="listitem">Switch back to the new spreadsheet. In the input line you will now see how $[officename] Calc has added the reference to the formula for you. </paragraph>
            <section id="otherdocref">
               <paragraph id="par_id5888241" role="listitem">The reference to a cell of another document contains the fully qualified name of the other document between single quotes <literal>(')</literal>, then a hash <literal>#</literal>, then the name of the sheet of the other document, followed by a period and the name or reference of the cell. </paragraph>
               <paragraph role="paragraph" id="par_id51672076541215">For example, <switchinline select="sys"><caseinline select="WIN">'file:///C:/Users/user/Documents/Price list.ods'#$'Information SKU'.H51</caseinline><defaultinline>'file:///home/user/Documents/Price list.ods'#$'Information SKU'.H51</defaultinline></switchinline>.</paragraph>
               <note id="par_id451672076939681">The path and document name URI <emph>must always</emph> be enclosed in single quotes. If the name contains single quotes (') they must be escaped using two single quotes (''). Only a sheet name may not be quoted if it does not contain a space or a character that would be an operator or the name would be pure numeric (for example, '123' must be quoted).</note>
            </section>
         </listitem>
         <listitem>
            <paragraph id="par_id7697683" role="listitem">Confirm the formula by clicking the green check mark.</paragraph>
         </listitem>
         <listitem>
            <paragraph id="par_id7099826" role="listitem">If you drag the box in the lower right corner of the active cell to select a range of cells, $[officename] automatically inserts the corresponding references in the adjacent cells. As a result, the sheet name is preceded with a "$" sign to designate it as an <link href="text/scalc/guide/relativ_absolut_ref.xhp">absolute reference</link>.</paragraph>
         </listitem>
      </list>
      <paragraph id="par_id674459" role="paragraph">If you examine the name of the other document in this formula, you will notice that it is written as a <link href="text/shared/00/00000002.xhp#url">URL</link>. This means that you can also enter a URL from the Internet.</paragraph>
      <section id="relatedtopics">
         <embed href="text/scalc/guide/cellreferences_url.xhp#cellreferences_url"/>
         <embed href="text/scalc/guide/relativ_absolut_ref.xhp#relativ_absolut_ref"/>
      </section>
   </body>
</helpdocument>
