title: GoogleFinance formula to find previous historical trading day of a stock
body: <p>I have been searching for a solid formula to find stock prices of &quot;previous trading days&quot; of a large batch of historical dates.</p>
  <p>The formula I started with:</p>
  <pre><code>=googlefinance(A5, &quot;close&quot;, B5-1)
  </code></pre>
  <p>where A5 refers to a ticker, and B5 refers to a date in the past.</p>
  <p>I get #NA results for previous days that fall on weekends or holidays.</p>
  <p>I need a formula that will work reliably for 365 days per year, no matter the day of the week or number of non-trading days prior.  I have tried something like this:</p>
  <pre><code>=index(googlefinance(A5, &quot;close&quot;, (B5-1)-2,2),2,2)
  </code></pre>
  <p>That formula works if the B5 date is the first trading day of the week, but not if it falls anywhere midweek.</p>
  <p>I tried using <code>WORKDAY(B5,-1)</code> in a few ways but I realize that function can only calculate a number of workdays, not produce a date.</p>
  <p>I need a formula that I do not have to edit and adjust cell by cell.</p>