title: AVERAGEIFS excluding cells that contain specified text
body: <p>I am trying to calculate average leverage levels for years 2010-2017 with <code>AVERAGEIFS</code>, but would want to exclude Infrastructure sector.</p>
  
  <p>Here's a formula that includes all sectors (simplified by removing the $-signs):</p>
  
  <pre><code>=AVERAGEIFS(V186:V891,J186:J891,H164)
  </code></pre>
  
  <p>V: leverage, J: year, H: year next to the formula cell</p>
  
  <p>I tried doing this:</p>
  
  <pre><code>=AVERAGEIFS(V186:V891,J186:J891,H165,K186:K891,{"Communication","Consumer Discretionary","Consumer Staples","Energy","Financials","Healthcare","Industrials","Materials","Other","Technology","Utilities"})
  </code></pre>
  
  <p>K: sectors</p>
  
  <p>My try to include all other sectors than Infrastructure doesn't work for some reason, because the average I get for e.g. year 2012 is 3.5 with the 1st formula, and 3.1 with the 2nd, although there're no Infrastructure deals that year. Additionally, some years return <code>#DIV/0!</code>.</p>
  
  <p>I also tried to search for a way to write the formula that excludes Infra deals in a simpler way, but didn't find anything. I'm thinking something like this:</p>
  
  <pre><code>=AVERAGEIFS(V186:V891,J186:J891,H164,K186:K891,NOT("Infrastructure"))
  </code></pre>
  
  <p>Question summarized: how could I calculate the average leverage level for each year, excluding infra deals?</p>