| Server IP : 121.121.20.254 / Your IP : 216.73.217.84 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/LibreOffice/help/en-US/text/scalc/01/ |
Upload File : |
<!DOCTYPE html>
<html lang="en-US" dir="ltr">
<head>
<base href="../../../../">
<noscript><meta http-equiv="refresh" content="0; URL=../../../../en-US/noscript.html"></noscript>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>AVERAGEIFS function</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="en-US/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="en-US/bookmarks.js" defer></script><script type="text/javascript" src="en-US/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="en-US/text/shared/05/new_help.html"><div></div></a><a class="logo" href="en-US/text/shared/05/new_help.html"><p dir="auto">LibreOffice 24.2 Help</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Module</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contents</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Search in bookmarks for chosen module" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<a name="averageifs_function"></a>
<a name="bm_id536295362953629"></a>
<a name="bm_id536715367153671"></a>
<meta itemprop="keywords" content="AVERAGEIFS function">
<meta itemprop="keywords" content="arithmetic mean,satisfying conditions">
<h1 id="hd_id537445374453744" dir="auto">
<a name="averageifs_head"></a>AVERAGEIFS function</h1>
<p id="par_id538405384053840" class="paragraph" dir="auto"><span class="avis"><a name="averageifs_des"></a>Returns the arithmetic mean of all cells in a range that satisfy given multiple criteria. The AVERAGEIFS function sums up all the results that match the logical tests and divides this sum by the quantity of selected values.</span></p>
<div class="embedded">
<a name="4.0"></a>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id651551401041640" dir="auto">This function is available since LibreOffice 4.0.</p></div>
</div>
<br>
</div>
<div class="embedded">
<a name="func_head_syntax"></a>
<h3 id="hd_id126511265112651" dir="auto">Syntax</h3>
</div>
<p id="par_id21050267713178" class="code" dir="auto">AVERAGEIFS(Func_Range; Range1; Criterion[; Range2; Criterion2][; … ; [Range127; Criterion127]])</p>
<p id="par_id165832700711773" class="paragraph" dir="auto"><span class="emph">Func_range</span> – required argument. It is a range of cells, a name of a named range or a label of a column or a row containing values for calculating the mean.</p>
<div class="embedded">
<a name="par00"></a>
<p id="par_id101585468691583" class="paragraph" dir="auto"><span class="emph">Range1</span> – required argument. It is a range of cells, a name of a named range, or a label of a column or a row, to which the corresponding criterion is to be applied.</p>
<a name="criterion"></a>
<p id="par_id621619279022341" class="paragraph" dir="auto"><span class="emph">Criterion</span>: A criterion is a single cell Reference, Number or Text. It is used in comparisons with cell contents.</p>
<p id="par_id731619279029255" class="paragraph" dir="auto">A reference to an empty cell is interpreted as the numeric value 0.</p>
<p id="par_id31619279035359" class="paragraph" dir="auto">A matching expression can be:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id171619279059462" class="listitem" dir="auto">A Number or Logical value. A matching cell content equals the Number or Logical value. </p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id511619279076504" class="listitem" dir="auto">A value beginning with a comparator (<, <=, =, >, >=, <>).</p>
<p id="par_id11619279168512" class="paragraph" dir="auto">For =, if the value is empty it matches empty cells.</p>
<p id="par_id161619279207350" class="paragraph" dir="auto">For <>, if the value is empty it matches non-empty cells.</p>
<p id="par_id271619279215695" class="paragraph" dir="auto">For <>, if the value is not empty it matches any cell content except the value, including empty cells.</p>
<p id="par_id861619279223855" class="paragraph" dir="auto"><span class="emph">Note:</span> "=0" does not match empty cells.</p>
<p id="par_id51619279363954" class="paragraph" dir="auto">For = and <>, if the value is not empty and can not be interpreted as a Number type or one of its subtypes and the property <a target="_top" href="en-US/text/shared/optionen/01060500.html">Search criteria = and <> must apply to whole cells</a> is checked, comparison is against the entire cell contents, if unchecked, comparison is against any subpart of the field that matches the criteria. For = and <>, if the value is not empty and can not be interpreted as a Number type or one of its subtypes applies. </p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id801619279323556" class="listitem" dir="auto">Other Text value. If the property <a target="_top" href="en-US/text/shared/optionen/01060500.html">Search criteria = and <> must apply to whole cells</a> is true, the comparison is against the entire cell contents, if false, comparison is against any subpart of the field that matches the criteria. The expression can contain text, numbers, regular expressions or wildcards (<a target="_top" href="en-US/text/shared/optionen/01060500.html#wildcards">if enabled in calculation options</a>).</p>
</li>
</ul>
<p id="par_id190621657742" class="paragraph" dir="auto"><span class="emph">Range2</span> – Optional. Range2 and all the following mean the same as Range1.</p>
<p id="par_id317001803813193" class="paragraph" dir="auto"><span class="emph">Criterion2</span> – Optional. Criterion2 and all the following mean the same as Criterion.</p>
</div>
<div class="embedded">
<a name="regex"></a>
<p id="par_id3147418" class="paragraph" dir="auto">The search supports wildcards or <a target="_top" href="en-US/text/shared/01/02100001.html">regular expressions</a>. With regular expressions enabled, you can enter "all.*", for example to find the first location of "all" followed by any characters. If you want to search for a text that is also a regular expression, you must either precede every regular expression metacharacter or operator with a "\" character, or enclose the text into \Q...\E. You can switch the automatic evaluation of wildcards or regular expression on and off in <a target="_top" href="en-US/text/shared/optionen/01060500.html"><span id="swlnsystextshared0000000001xml_3" class="switchinline"><span hidden="true" id="MACtextshared0000000001xml_3" class="MAC"><span class="menuitem">LibreOffice - Preferences</span></span><span hidden="true" id="defaulttextshared0000000001xml_3"><span class="menuitem">Tools - Options</span></span></span><span class="menuitem"> - LibreOffice Calc - Calculate</span></a>.</p>
<a name="regexnumex"></a>
<div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id651572973288601" dir="auto">When using functions where one or more arguments are search criteria strings that represents a regular expression, the first attempt is to convert the string criteria to numbers. For example, ".0" will convert to 0.0 and so on. If successful, the match will not be a regular expression match but a numeric match. However, when switching to a locale where the decimal separator is not the dot makes the regular expression conversion work. To force the evaluation of the regular expression instead of a numeric expression, use some expression that can not be misread as numeric, such as ".[0]" or ".\0" or "(?i).0". </p></div>
</div>
<br>
</div>
<div class="embedded">
<a name="warning01"></a>
<p id="par_id14734320631377" class="paragraph" dir="auto"><span class="emph">Func_Range</span> and <span class="emph">Range1, Range2...</span> must have the same size, otherwise the function returns err:502 - Invalid argument.</p>
</div>
<div class="embedded">
<a name="note01"></a>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id94162948227556" dir="auto">The logical relation between criteria can be defined as logical AND (conjunction). In other words, if and only if all given criteria are met, a value from the corresponding cell of the given <span class="emph">Func_Range</span> is taken into calculation.</p></div>
</div>
<br>
</div>
<div class="embedded">
<a name="par01"></a>
<p id="par_id191527781733238" class="paragraph" dir="auto">The function can have up to 255 arguments, meaning that you can specify 127 criteria ranges and criteria for them.</p>
<p id="par_id175721789527973" class="paragraph" dir="auto">If a cell contains TRUE, it is treated as 1, if a cell contains FALSE – as 0 (zero).</p>
</div>
<div class="embedded">
<a name="odff"></a>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="hd_id1000010" dir="auto">This function is part of the Open Document Format for Office Applications (OpenDocument) standard Version 1.2. (ISO/IEC 26300:2-2015)</p></div>
</div>
<br>
</div>
<div class="embedded">
<a name="ex_func_average"></a>
<div class="embedded">
<a name="sectionexample"></a>
<h4 id="hd_id281171" dir="auto">Example</h4>
</div>
<p id="hd_id2609201512474295" class="paragraph" dir="auto">Consider the following table</p>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<td rowspan="" colspan="" dir="auto">
</td>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id2509201517430799" class="tableheadintable" dir="auto">A</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id250920151743116" class="tableheadintable" dir="auto">B</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id2509201517431582" class="tableheadintable" dir="auto">C</p>
</th>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id2509201517431967" class="tableheadintable" dir="auto">1</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id18260631312423" class="tablecontentintable" dir="auto">Product Name</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2509201517433075" class="tablecontentintable" dir="auto">Sales</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2509201519383294" class="tablecontentintable" dir="auto">Revenue</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id959660094035" class="tableheadintable" dir="auto">2</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2855779586764" class="tablecontentintable" dir="auto">pencil</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id110202156219769" class="tablecontentintable" dir="auto">20</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id23281929326512" class="tablecontentintable" dir="auto">65</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id2509201517432278" class="tableheadintable" dir="auto">3</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id24967262611733" class="tablecontentintable" dir="auto">pen</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2509201517433391" class="tablecontentintable" dir="auto">35</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id250920151938352" class="tablecontentintable" dir="auto">85</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id250920151743267" class="tableheadintable" dir="auto">4</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id252542413030532" class="tablecontentintable" dir="auto">notebook</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2509201517433781" class="tablecontentintable" dir="auto">20</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2509201519383822" class="tablecontentintable" dir="auto">190</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id2509201519371339" class="tableheadintable" dir="auto">5</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2509201519374677" class="tablecontentintable" dir="auto">book</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2509201519373350" class="tablecontentintable" dir="auto">17</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id2509201519384171" class="tablecontentintable" dir="auto">180</p>
</td>
</tr>
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id6009596127912" class="tableheadintable" dir="auto">6</p>
</th>
<td rowspan="" colspan="" dir="auto">
<p id="par_id19479417931163" class="tablecontentintable" dir="auto">pencil-case</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id85353130721737" class="tablecontentintable" dir="auto">not</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id15693941827291" class="tablecontentintable" dir="auto">not</p>
</td>
</tr>
</table>
<br>
<div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id1191767622119" dir="auto">In all examples below, ranges for calculation contain the row #6, which is ignored because it contains text.</p></div>
</div>
<br>
</div>
<h4 id="hd_id20733192524041" dir="auto">Simple usage</h4>
<p id="par_id24004653627203" class="paragraph" dir="auto"><span class="input" data-tooltip="Click on text to copy to clipboard">=AVERAGEIFS(B2:B6;B2:B6;">=20")</span></p>
<p id="par_id30201168686268" class="paragraph" dir="auto">Calculates the average for values of the range B2:B6 that are greater than or equal to 20. Returns 25, because the fifth row does not meet the criterion.</p>
<p id="par_id30279247419921" class="paragraph" dir="auto"><span class="input" data-tooltip="Click on text to copy to clipboard">=AVERAGEIFS(C2:C6;B2:B6;">=20";C2:C6;">70")</span></p>
<p id="par_id2930764965983" class="paragraph" dir="auto">Calculates the average for values of the range C2:C6 that are greater than 70 and correspond to cells of B2:B6 with values greater than or equal to 20. Returns 137.5, because the second and fifth rows do not meet at least one criterion.</p>
<h4 id="hd_id317532515726820" dir="auto">Using regular expressions and nested functions</h4>
<p id="par_id457966021670" class="paragraph" dir="auto"><span class="input" data-tooltip="Click on text to copy to clipboard">=AVERAGEIFS(C2:C6;B2:B6;">"&MIN(B2:B6);B2:B6;"<"&MAX(B2:B6))</span></p>
<p id="par_id66091035229950" class="paragraph" dir="auto">Calculates the average for values of the range C2:C6 that correspond to all values of the range B2:B6 except its minimum and maximum. Returns 127.5, because the third and fifth rows do not meet at least one criterion.</p>
<p id="par_id303162761931870" class="paragraph" dir="auto"><span class="input" data-tooltip="Click on text to copy to clipboard">=AVERAGEIFS(C2:C6;A2:A6;"pen.*";B2:B6;"<"&MAX(B2:B6))</span></p>
<p id="par_id40031348913642" class="paragraph" dir="auto">Calculates the average for values of the range C2:C6 that correspond to all cells of the A2:A6 range starting with "pen" and to all cells of the B2:B6 range except its maximum. Returns 65, because only second row meets all criteria.</p>
<h4 id="hd_id31201205191857" dir="auto">Reference to a cell as a criterion</h4>
<p id="par_id316794795433" class="paragraph" dir="auto">If you need to change a criterion easily, you may want to specify it in a separate cell and use a reference to this cell in the condition of AVERAGEIFS function. For example, the above function can be rewritten as follows:</p>
<p id="par_id67531072426731" class="paragraph" dir="auto"><span class="input" data-tooltip="Click on text to copy to clipboard">=AVERAGEIFS(C2:C6;A2:A6;E2&".*";B2:B6;"<"&MAX(B2:B6))</span></p>
<p id="par_id65612244926745" class="paragraph" dir="auto">If E2 = pen, the function returns 65, because the link to the cell is substituted with its content.</p>
<div class="embedded">
<a name="func_ifs"></a>
<p id="par_id721528312694192" class="paragraph" dir="auto"></p>
</div>
<a name="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a name="related"></a><span class="emph">Related Topics</span>
</p>
<div class="relatedbody" itemprop="mentions">
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id371677017196557" dir="auto"><a target="_blank" href="https://wiki.documentfoundation.org/Documentation/Calc_Functions/AVERAGEIFS">AVERAGEIFS wiki page</a>.</p></div>
</div>
<br>
<p id="par_id11921178730928" class="paragraph" dir="auto">
<a target="_top" href="en-US/text/scalc/01/04060184.html#average">AVERAGE</a>,
<a target="_top" href="en-US/text/scalc/01/04060184.html#averagea">AVERAGEA</a>,
<a target="_top" href="en-US/text/scalc/01/04060184.html#avedev">AVEDEV</a>,
<a target="_top" href="en-US/text/scalc/01/func_averageif.html">AVERAGEIF</a>
</p>
<p id="par_id11931178730928" class="paragraph" dir="auto">
<a target="_top" href="en-US/text/scalc/01/func_countifs.html">COUNTIFS</a>,
<a target="_top" href="en-US/text/scalc/01/func_minifs.html">MINIFS</a>,
<a target="_top" href="en-US/text/scalc/01/func_maxifs.html">MAXIFS</a>,
<a target="_top" href="en-US/text/scalc/01/func_averageifs.html">AVERAGEIFS</a>,
<a target="_top" href="en-US/text/scalc/01/func_sumifs.html">SUMIFS</a>
</p>
<p id="par_id20741445030307" class="paragraph" dir="auto"><a target="_top" href="en-US/text/shared/01/02100001.html">List of Regular Expressions</a></p>
</div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/scalc/01/func_averageifs.xhp" target="_blank">/text/scalc/01/func_averageifs.xhp</a></p>
<p dir="auto">Title is: AVERAGEIFS function</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>