title: ArrayFormula SWITCH SEQUENCE
body: <p>My <strong>apologies</strong>, no link to a spreadsheet (its a big one). Was hoping an expert could give some anecdotal advice why the first formula works and the second does not.</p>
  <p>Specifically, I can narrow it down to SEQUENCE function (if I remove SEQUENCE there is no #VALUE! error). All range names are columns except for MaxOneTerms which is a number.</p>
  <p>Following using IF works fine.</p>
  <pre><code>=ARRAYFORMULA(
    IF(NOT(ISNUMBER(OneStep)),,
      TRIM(TRANSPOSE(QUERY(TRANSPOSE(
        IF(SEQUENCE(1,MaxOneTerms,1)&gt;OneTerms,,
          IF(OneType=&quot;Geo&quot;,
            ROUND(OneStart*OneStep^SEQUENCE(1,MaxOneTerms,0)),
            IF(OneType=&quot;Ari&quot;,
              ROUND(OneStart+OneStep*SEQUENCE(1,MaxOneTerms,0)),
              &quot;OneType-ERR&quot;
            )
          )&amp;&quot;,&quot;
        )
      ),,100000)))
    )
  )
  </code></pre>
  <p>The following with SWITCH (replacing IF for readability) returns #VALUE! for each value.</p>
  <pre><code>=ARRAYFORMULA(
    IF(NOT(ISNUMBER(OneStep)),,
      TRIM(TRANSPOSE(QUERY(TRANSPOSE(
        IF(SEQUENCE(1,MaxOneTerms,1)&gt;OneTerms,,
          SWITCH(OneType,
            &quot;Geo&quot;,ROUND(OneStart*OneStep^SEQUENCE(1,MaxOneTerms,0)),
            &quot;Ari&quot;,ROUND(OneStart+OneStep*SEQUENCE(1,MaxOneTerms,0)),
            &quot;OneType-ERR&quot;
          )&amp;&quot;,&quot;
        )
      ),,100000)))
    )
  )
  </code></pre>
  <p>The following with SWITCH, but without SEQUENCE executes (but obviously not the expected values).</p>
  <pre><code>=ARRAYFORMULA(
    IF(NOT(ISNUMBER(OneStep)),,
      TRIM(TRANSPOSE(QUERY(TRANSPOSE(
        IF(SEQUENCE(1,MaxOneTerms,1)&gt;OneTerms,,
          SWITCH(OneType,
            &quot;Geo&quot;,ROUND(OneStart*OneStep),
            &quot;Ari&quot;,ROUND(OneStart+OneStep),
            &quot;OneType-ERR&quot;
          )&amp;&quot;,&quot;
        )
      ),,100000)))
    )
  )
  </code></pre>
  <hr />
  <p>Edit 1: (linked added below).
  Sheet &quot;SeriesX&quot; column &quot;S&quot; row 3. Please ignore the rest.
  I've tried variants in Sheet &quot;SeriesX2&quot; F3,G3,H3</p>
  <p>google <a href="https://docs.google.com/spreadsheets/d/1P7Jq_h4V4mGOZN6eqLdDfFs8p9FjsD-k__I09Eeoy0w/edit?usp=sharing" rel="nofollow noreferrer">sheet</a></p>