Home > Back-end >  How to return found values from one query when the others return #N/A using Google Sheets formula?
How to return found values from one query when the others return #N/A using Google Sheets formula?

Time:06-25

So, this formula has 3 QUERY() wrapped into one so that the results are vertically set. The problem is that when one of the queries doesn't find any values, it returns a #VALUE saying: In ARRAY_LITERAL, an Array Literal was missing values for one or more rows.

I've tried IFERROR(), wrapping it all in anothe rQUERY(), but it doesn't work.

=QUERY({
query({Sheet1!A:FR},"Select Col142,Col11,Col12,Col74 where Col7 = '"&P4&"' and not Col142 contains '#N/A' and not Col142 matches '-' and Col142 is not null",0);
query({Sheet1!A:FR},"Select Col150,Col11,Col12,Col78 where Col7 = '"&P4&"' and not Col150 contains '#N/A' and not Col150 matches '-' and Col150 is not null",0);
query({Sheet1!A:FR},"Select Col152,Col11,Col12,Col82 where Col7 = '"&P4&"' and not Col152 contains '#N/A' and not Col152 matches '-' and Col152 is not null",0)
},"select * where Col1 <> '#N/A' and Col1 is not ''")

Appreciate your help!

Thanks!

CodePudding user response:

You have to apply iferror on each individual query and give a complete row of blanks, that is

iferror(query(_____________),{"","","",""})

if query is supposed to fetch 4 results per row

  • Related