google-sheetsgoogle-apps-scriptfilterimportfiltering

How to use the cell number instead of its value in a Filter + Importrange


Can I use a cell number, like A2 where the value is "PRogramid1=" instead of using the "PRogramid1=" in the formula: =filter(IMPORTRANGE("1xxxxxxxxxxxxxxxxI", "Sheet1!A7990:AC11000"),"Sheet1!A7990:AC11000"),0,8)="A2",index(IMPORTRANGE("1xxxxxxxxxxxxxxxxI", "Sheet1!A7990:AC11000"),0,2)=Today)

Or is there anyway, where I can create a nested filter with a dropdown list of: "PRogramid1=" , "PRogramid2=", "PRogramid3=" and the list goes on in the destination google file sheet1 A2? Then, create another formula? So, I can use the cell number "A2" instead its value: ""PRogramid1="

I'm using =filter(IMPORTRANGE("1xxxxxxxxxxxxxxxxI", "Sheet1!A7990:AC11000"), index(IMPORTRANGE("1xxxxxxxxxxxxxxxxI", "Sheet1!A7990:AC11000"),0,8)="PRogramid1=",index(IMPORTRANGE("1xxxxxxxxxxxxxxxxI", "Sheet1!A7990:AC11000"),0,2)=Today)


Solution

  • Use QUERY() function like-

    =QUERY(IMPORTRANGE("1zioFHESlQPd5480n7HdnS2D17CpDeWfgAIWWzJn6qvM","TVProgram!A3:AI"),
    "select * where Col8='"&A2&"' and Col2=date '" & TEXT(TODAY(),"yyyy-mm-dd") &"'",1)
    

    See your sheet please.

    enter image description here