title: Using a column reference for a vlookup formula
body: <p>When inserting a table in Excel you can refer to:</p>
  
  <ul>
  <li>the data range <code>Table[#data]</code></li>
  <li>header range <code>Table[#header]</code></li>
  <li>full column range <code>Table[column name]</code> or </li>
  <li>value of current row under certain column <code>Table[@[colum name]]</code> </li>
  </ul>
  
  <p>which makes formulas very easy to read: <code>=COUNTIF(A:A,A1)</code> becomes</p>
  
  <p><code>=COUNTIF(Suppliers[IBAN],Suppliers[@[IBAN]])</code> </p>
  
  <p>to quickly check for duplicates (IBAN) of the current row value.</p>
  
  <p>I'm now trying to convert <code>=VLOOKUP([@SupplierCode],Suppliers[Code],2,False)</code> into</p>
  
  <p><code>=VLOOKUP([@SupplierCode],Suppliers[Code],Suppliers[Name],False)</code> </p>
  
  <p>So in other words, <strong>a way to get the column index of a column within a tableObject to use it in a formula (i.e. vlookup)</strong>. </p>
  
  <p>I could probably write a VBA function that does this, but I'm trying to find out if Excel has a way to handle this <strong>without VBA code</strong></p>
  
  <p><strong>The VBA solution I do not want</strong> (but might settle for in case it is not possible):</p>
  
  <pre class="lang-vb prettyprint-override"><code>Public Function GetColumnIndex(TableName As String, ColumName As String) As Long
      GetColumnIndex = ActiveSheet.ListObjects(TableName).ListColumns(ColumName).Index
  End Function
  </code></pre>
  
  <p>allowing me to write: <code>=VLOOKUP([@SupplierCode],Suppliers,GetColumnIndex("suppliers","Name"),FALSE)</code></p>
  
  <p>works, as long as the tables are on the same sheet</p>