title: Excel formula not working: date and number ranges
body: <p>I have been trying to make this work in cell I1:</p>
  <pre><code>=IF(B18=&quot;&quot;,&quot;&quot;,IF(AND(OR(C16=7,C16=&quot;J&quot;,C16=8),B18&lt; 300,D16&lt; DATE(2021,5,15),300,IF(B18&lt; 350),350,B18),(IF(AND(OR(C16=4,C16=&quot;T&quot;),B18&lt; 500),500,B18))))
  </code></pre>
  <p>Where:
  if C16 is 7 or J or 8
  and
  the date in D16&lt; DATE(2021,5,15)
  and
  B18&lt;300
  Result in I1=300 otherwise B18 (in case B18 is over 300).</p>
  <p>Otherwise if D16&gt; DATE(2021,5,15) and B18&lt;350 I1=350.
  If B18&gt;350, I1=B18</p>
  <p>Sorry...it looks messy!
  R</p>