Google Sheets: Query Question.

p_s

New Member
Joined
Sep 23, 2020
Messages
28
Office Version
  1. 2019
Platform
  1. Windows
  2. Mobile
  3. Web
Is there a way to use the query function where your reference can have more than 1 possible value?

Example:
Excel Formula:
=QUERY(IMPORTDATA(https://website.com/mydatasetURL.csv),"SELECT A, B, C, D, E WHERE C = '"&PossibleReferences!A1:A50&"'",0)

Is there a way to do this without putting 50 OR statements in the query. And will this work with an external data set?

PossibleReferences!A1:A50 are text string values

Also, if we put it the dataset in the query will it still update automatically? Or do I need to keep refreshing that sheet?
 
Last edited by a moderator:

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

p_s

New Member
Joined
Sep 23, 2020
Messages
28
Office Version
  1. 2019
Platform
  1. Windows
  2. Mobile
  3. Web
So I found a solution that worked for me. But there is a limitation of 50000 characters in a join statement, and I have had 1600+ queries.

Excel Formula:
=QUERY(IMPORTDATA("https://MYURL.COM/sheet.csv"),"SELECT * WHERE Col1 = "&JOIN(" OR Col1 = ",FILTER(I:I,I:I>0)),1)
 

Watch MrExcel Video

Forum statistics

Threads
1,130,439
Messages
5,642,121
Members
417,257
Latest member
Sarahbw

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
Top