Google Sheets - Array of Queries without results

Ivah

New Member
Joined
May 15, 2023
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I have a problem with google sheets array formula, one of the queries has no results and I get an error in the output.

Here is the formula, the formula is searching for the month name in each of 3 sheets per input in cell B3, and then searches if there is a change in column vs month before. I get the results but if one of the queries doesn't have a row that satisfies the conditions I get an error.
I tried to wrap queries in iferror, but the error is the same.

Code:
={
QUERY(List1!A:AZ,"SELECT A,D,E WHERE ("&SUBSTITUTE(ADDRESS(1, MATCH(B1, List1!1:1, 0)-1, 4), "1", "")&"='Status1' OR "&SUBSTITUTE(ADDRESS(1, MATCH(B1, List1!1:1, 0)-1, 4), "1", "")&"='Status2') AND "&SUBSTITUTE(ADDRESS(1, MATCH(B1, List1!1:1, 0), 4), "1", "")&"='Status3'",1);

QUERY(List2!A:AZ,"SELECT A,D,E WHERE ("&SUBSTITUTE(ADDRESS(1, MATCH(B1, List2!1:1, 0)-1, 4), "1", "")&"='Status1' OR "&SUBSTITUTE(ADDRESS(1, MATCH(B1, List2!1:1, 0)-1, 4), "1", "")&"='Status2') AND "&SUBSTITUTE(ADDRESS(1, MATCH(B1, List2!1:1, 0), 4), "1", "")&"='Status3'",0);

QUERY(List3!A:AZ,"SELECT A,D,E WHERE ("&SUBSTITUTE(ADDRESS(1, MATCH(B1, List3!1:1, 0)-1, 4), "1", "")&"='Status1' OR "&SUBSTITUTE(ADDRESS(1, MATCH(B1, List3!1:1, 0)-1, 4), "1", "")&"='Status2') AND "&SUBSTITUTE(ADDRESS(1, MATCH(B1, List3!1:1, 0), 4), "1", "")&"='Status3'",0)

}

Sheet example
Country CodeClassY2023NameCityJan-2023Feb-2023Mar-2023Apr-2023
USAAYesNylahWashingtonStatus1Status1Status1Status1
USABYesAlvaroSeatleStatus1Status1Status1Status1
USAAYesFridaDenverStatus1Status3Status3Status3
USACYesRachaelWashingtonStatus1Status1Status1Status1
USACNoRonnieMarylandStatus3Status3Status3Status3
USAANoIssacWashingtonStatus1Status2Status2Status2
USACNoZackSeatleStatus2Status2Status2Status2
USABNoNatalyaDenverStatus2Status2Status2Status2
USABNoTiannaMarylandStatus2Status2Status2Status2


Thank you!
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,224,876
Messages
6,181,521
Members
453,050
Latest member
Obil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top