Google sheet query to replace blank cells with other data

Viewed 89
2 Answers

I know only one option is to use IF() function like-

=ArrayFormula(IF(QUERY('pending SKUs'!E2:AQ,"select F, G, H, L, M, N, O, I where E=1 AND P <> 2 AND P <> 3 AND X='Pass' AND AQ <> 'Rejected'")="",0,
QUERY('pending SKUs'!E2:AQ,"select F, G, H, L, M, N, O, I where E=1 AND P <> 2 AND P <> 3 AND X='Pass' AND AQ <> 'Rejected'")))

If your query is only generating numeric data, then you can use the N function to transform the blanks into zeros without having to refer to the query twice as per the IF approach:

=ARRAYFORMULA(N(QUERY('pending SKUs'!E2:AQ,"select F, G, H, L, M, N, O, I where E=1 AND P <> 2 AND P <> 3 AND X='Pass' AND AQ <> 'Rejected'")))

N.B - ARRAYFORMULA is also needed to iterate N over the whole query array.

Related