Search code examples
google-sheetsgoogle-sheets-formulaarray-formulas

Using INDIRECT in Array Formula


I use this arrayformula along with INDIRECT because it is the only way I know to maintain my references since the reference sheet has in the script to routinely add another row to sheet Data!. How can I either add to the below formula to only show values in the array that are above the value in $CQ$17 and below the value in $CQ$16? Can this be done without increasing my sheets processing time since it updates every minute?

=ARRAYFORMULA(INDIRECT("Data!E"&13+$F$7&":E"&597+$F$7))

Solution

  • IIUC, you do not need no INDIRECT and could use either QUERY:

    =QUERY(
      OFFSET(Data!E13, $F$7, 0, 597 - 13 + 1, 1),
      "
        select E
        where E > " & $CQ$17 & " and
              E < " & $CQ$16,
      -1
    )
    

    or FILTER:

    =FILTER(
      OFFSET(Data!E13, $F$7, 0, 597 - 13 + 1),
      OFFSET(Data!E13, $F$7, 0, 597 - 13 + 1) > $CQ$17,
      OFFSET(Data!E13, $F$7, 0, 597 - 13 + 1) < $CQ$16
    )
    

    Those three times constructing the same range are not good, I would go with QUERY.

    A sample sheet would be really helpful though.