<?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="textscalcguidespecialfilterxml" indexer="include" status="PUBLISH">
    <title id="tit">Applying Advanced Filters</title>
    <filename>/text/scalc/guide/specialfilter.xhp</filename>
  </topic>
</meta>
<body>

<bookmark branch="index" id="bm_id3148798"><bookmark_value>filters;defining advanced filters </bookmark_value>
<bookmark_value>advanced filters</bookmark_value>
<bookmark_value>defining; advanced filters</bookmark_value>
<bookmark_value>database ranges; advanced filters</bookmark_value>
</bookmark>
<comment>MW made "applying;advanced filters" a one level entry</comment>
<section id="AdvancedFilter">
  <h1 id="hd_id3148798"><variable id="specialfilter"><link href="text/scalc/guide/specialfilter.xhp">Applying Advanced Filters</link>
</variable></h1>
  <list type="ordered">
   <listitem>
    <paragraph id="par_id3145785" role="listitem">Copy the column headers of the sheet ranges to be filtered into an empty area of the sheet, and then enter the criteria for the filter in a row beneath the headers. Horizontally arranged data in a row will always be logically connected with AND, and vertically arranged data in a column will always be logically connected with OR.</paragraph>
   </listitem>
   <listitem>
    <paragraph id="par_id3153142" role="listitem">Once you have created a filter matrix, select the sheet ranges to be filtered. Open the <emph>Advanced Filter</emph> dialog by choosing <menuitem>Data - More Filters - Advanced Filter</menuitem>, and define the filter conditions.</paragraph>
   </listitem>
   <listitem>
       <paragraph id="par_id3153726" role="listitem">Then click OK, and you will see that only the rows from the original sheet whose contents have met the search criteria are still visible. All other rows are temporarily hidden and can be made to reappear with the <menuitem>Format - Rows - Show</menuitem> command.</paragraph>
   </listitem>
  </list>
  <h2 id="par_id3149664">Example</h2>
  <paragraph id="par_id3147427" role="paragraph">Load a spreadsheet with a large number of records. We are using a fictional <emph>Turnover</emph> document, but you can just as easily use any other document. The document has the following layout:</paragraph>
  <table id="tbl_id3149377">
   <tablerow>
    <tablecell/>
    <tablecell>
     <paragraph id="par_id3154510" role="tablehead" localize="false"> <emph>A</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3150327" role="tablehead" localize="false"> <emph>B</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3154756" role="tablehead" localize="false"> <emph>C</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3155335" role="tablehead" localize="false"> <emph>D</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3146315" role="tablehead" localize="false"> <emph>E</emph> </paragraph>
    </tablecell>
   </tablerow>
   <tablerow>
    <tablecell>
     <paragraph id="par_id3145790" role="tablehead" localize="false"> <emph>1</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3159239" role="paragraph">Month</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3150086" role="paragraph">Standard</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3150202" role="paragraph">Business</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3150883" role="paragraph">Luxury</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3152987" role="paragraph">Suite</paragraph>
    </tablecell>
   </tablerow>
   <tablerow>
    <tablecell>
     <paragraph id="par_id3154486" role="tablehead" localize="false"> <emph>2</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3148839" role="paragraph">January</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3153816" role="paragraph" localize="false">125600</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3157978" role="paragraph" localize="false">200500</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3155268" role="paragraph" localize="false">240000</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3153286" role="paragraph" localize="false">170000</paragraph>
    </tablecell>
   </tablerow>
   <tablerow>
    <tablecell>
     <paragraph id="par_id3146782" role="tablehead" localize="false"> <emph>3</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3149900" role="paragraph">February</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3154763" role="paragraph" localize="false">160000</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3150050" role="paragraph" localize="false">180300</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3153801" role="paragraph" localize="false">362000</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3154708" role="paragraph" localize="false">220000</paragraph>
    </tablecell>
   </tablerow>
   <tablerow>
    <tablecell>
     <paragraph id="par_id3151191" role="tablehead" localize="false"> <emph>4</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3147250" role="paragraph">March</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3153334" role="paragraph" localize="false">170000</paragraph>
    </tablecell>
    <tablecell/>
    <tablecell/>
    <tablecell>
     <paragraph id="par_id3151391" role="paragraph">and so on...</paragraph>
    </tablecell>
   </tablerow>
  </table>
  <paragraph id="par_id3147300" role="paragraph">Copy row 1 with the row headers (field names), to row 20, for example. Enter the filter conditions linked with OR in rows 21, 22, and so on.</paragraph>
  <table id="tbl_id3166462">
   <tablerow>
    <tablecell/>
    <tablecell>
     <paragraph id="par_id3159115" role="tablehead" localize="false"> <emph>A</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3146886" role="tablehead" localize="false"> <emph>B</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3153124" role="tablehead" localize="false"> <emph>C</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3152979" role="tablehead" localize="false"> <emph>D</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3145827" role="tablehead" localize="false"> <emph>E</emph> </paragraph>
    </tablecell>
   </tablerow>
   <tablerow>
    <tablecell>
     <paragraph id="par_id3149892" role="tablehead" localize="false"> <emph>20</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3150693" role="paragraph">Month</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3147475" role="paragraph">Standard</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3154846" role="paragraph">Business</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3153082" role="paragraph">Luxury</paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3149506" role="paragraph">Suite</paragraph>
    </tablecell>
   </tablerow>
   <tablerow>
    <tablecell>
     <paragraph id="par_id3149188" role="tablehead" localize="false"> <emph>21</emph> </paragraph>
    </tablecell>
    <tablecell>
     <paragraph id="par_id3149956" role="paragraph">January</paragraph>
    </tablecell>
    <tablecell/>
    <tablecell/>
    <tablecell/>
    <tablecell/>
   </tablerow>
   <tablerow>
    <tablecell>
     <paragraph id="par_id3150865" role="tablehead" localize="false"> <emph>22</emph> </paragraph>
    </tablecell>
    <tablecell/>
    <tablecell>
     <paragraph id="par_id3155957" role="paragraph" localize="false">&gt;160000</paragraph>
    </tablecell>
    <tablecell/>
    <tablecell/>
    <tablecell/>
   </tablerow>
  </table>
  <paragraph id="par_id3153566" role="paragraph">Specify that only rows which either have the value <literal>January</literal> in the <emph>Month</emph> cells OR a value of over 160000 in the <emph>Standard</emph><comment>standard not default, look at U59!!!</comment> cells will be displayed.</paragraph>
  <paragraph id="par_id3147372" role="paragraph">Choose <menuitem>Data - More Filters - Advanced Filter</menuitem>, and then select the range A20:E22. After you click OK, only the filtered rows will be displayed. The other rows will be hidden from view.</paragraph>
</section>

<section id="relatedtopics">
  <embed href="text/scalc/guide/filters.xhp#filters"/>
  <embed href="text/scalc/guide/autofilter.xhp#autofilter"/>
  <embed href="text/scalc/guide/cellcopy.xhp#cellcopy"/>
</section>
</body>
</helpdocument>
