title: Search a value from another tab/sheet in google sheets based on cell reference
body: <p>I'm trying to create a search page in google sheets where the user enters a value in one cell(s) and then other cells auto-populate with values from another tab/sheet based on the value entered in the search cell(s). </p>
  
  <p>I'm trying to use <code>VLOOKUP</code> up in an array but it gives either error or <code>N/A</code>.</p>
  
  <p>I have 'sheet1' with data from a google forms (columns from A to BN) and I'm trying to make a search page in 'Sheet2' where on top the user can write for example the ID-number, and I want to grab the value of a column from 'sheet1' that matches the ID-number written on the same row for 'sheet1'.</p>
  
  <p>I've already checked:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/56064287/vlookup-to-the-left-from-another-sheet-in-google-sheets">VLOOKUP to the left from another sheet in Google Sheets</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/54412813/how-to-get-value-depending-on-list-selection-in-spreadsheet">How to get value depending on list selection in spreadsheet?</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/52757088/google-sheets-vlookup-inside-arrayformula">Google sheets - VLOOKUP inside ARRAYFORMULA</a></p></li>
  </ul>
  
  <p>There are others but I'm not looking for any scripts.</p>
  
  <p>In simple form the formula would be:</p>
  
  <pre><code>=VLOOKUP(B3,'sheet1'!A:BN,40,False)
  </code></pre>
  
  <p>But because I have too many columns and I'll be needing to grab other values too I'm using:</p>
  
  <pre><code>=ArrayFormula(IF(LEN(B3),VLOOKUP(B3,{'sheet1'!A:BN},{iferror(match("ID-number",'sheet1'!A1:BN1,0),"No match")},FALSE),""))
  </code></pre>
  
  <p>Explanation:</p>
  
  <p>B3 is the cell where the user inputs the id number value</p>
  
  <p>Then ...:</p>
  
  <pre><code>{'sheet1'!A:BN},{iferror(match("ID-number",'sheet1'!A1:BN1,0),"No match")}
  </code></pre>
  
  <p>is where I'm looking for the number of the column of the title of value I'm looking for, in this case, it is AN, which would be the column 40 but it could be any other.</p>
  
  <p>And then the ArrayFormula is because sheet1 is data from a Google form that is on use and increasing rows constantly. </p>
  
  <p>It gives me an error of <code>#N/A</code> because it doesn't find the value (input in B3 in sheet 2) in the range (tab sheet1 in all the columns from A to BN that have values)</p>
  
  <p><strong>Example sheet with working answer is [here]:</strong> 
   (<a href="https://docs.google.com/spreadsheets/d/1qLcJdCn4EdV7lPOAfZ_CMak1LBkve45FL5SXyqBV3L8/edit?usp=sharing" rel="nofollow noreferrer">https://docs.google.com/spreadsheets/d/1qLcJdCn4EdV7lPOAfZ_CMak1LBkve45FL5SXyqBV3L8/edit?usp=sharing</a>)</p>
  
  <p><strong>NOTE:</strong> The values to search/return are on the same row in sheet 1 and when a new search is entered then only the row changes. </p>