title: How to use ARRAYFORMULA + FILTER within Google Spreadsheet?
body: <p>I have a Google spreadsheet with basically a dictionary of key/value pairs. Keys are unique. In a second sheet I need to add one or more rows for every key in the dictionary with some data. In this very sheet I'd need to also report the proper value for each key.</p>
  
  <p>To do so I have tried to combine the ARRAYFORMULA function with a number of other functions on the very first row of the second sheet to avoid (if possible) the need to copy the same formula on all rows of the value column.</p>
  
  <p>So far, neither QUERY nor FILTER worked.</p>
  
  <p>QUERY requires all data, there included the arguments to the WHERE predicate, to reside on a single sheet. In my case, the filtering key would be on the second sheet while the dictionary is on the first one. So this cannot be used at all.</p>
  
  <p>FILTER seems to have a weird (to me) behavior when both used in conjunction with ARRAYFORMULA and without it.</p>
  
  <p>You can have a look to my test Google Sheet 
  <a href="https://docs.google.com/spreadsheets/d/1eFyp4MOUA8N0g_I0eQhA0TIMqCauDqSNSoInecRT104/edit?usp=sharing" rel="noreferrer">here</a> or to snapshots here with ARRAYFORMULA (column B), without it (column C) and what I'd like to get (column D):</p>
  
  <p><a href="https://i.stack.imgur.com/EpA8b.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EpA8b.png" alt="KEY sheet with the key/value pairs"></a></p>
  
  <p><a href="https://i.stack.imgur.com/1M5Qe.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1M5Qe.png" alt="DATA sheet with the data for the keys"></a></p>
  
  <p>A little step further from pnuts' solution provides the "perfect" result without the "N/A" cells:</p>
  
  <pre><code>=ARRAYFORMULA(IF(A3:A="";"";VLOOKUP(A3:A;KEYS!A1:B;2;FALSE)))
  </code></pre>
  
  <p>Of course there is a major impact on the performances as the VLOOKUP is run once for every single line in in the second sheet (and this was also why I was trying to use FILTER).
  Those performances are quite low even with the currently linked example sheet, which is really skinny.</p>