Query with importange help(Google Sheets)

Discussion in 'Programming & Software Development' started by german, Apr 11, 2018.

  1. german

    german Member

    Joined:
    Nov 6, 2003
    Messages:
    936
    Hey, hopefully this is the correct section for this.

    Currently doing up a large project involving multiple google sheet workbooks and the final step i'm completely stumped on.

    The formula further down is what i'm stuck on. Right now it needs to look at the data entry tab(pic 1) and pull across number, name and their choice of category.

    What I'm needing to do is if it the contestant chooses Bikini/Swimsuit Under 25(example) as Division 1 or Division 2 it shows under Division 1 on the Bikini/Swimsuit Under 25 tab, which it currently is. But I need it to only show Bikini/Swimsuit Under 25 on column C not C and/or D. As you can see below, it's showing Div 1 and Div 2 info.


    DataEntry - Straight forward, where entrants are entered and their 2 divisions are chosen.
    upload_2018-4-11_14-56-46.png


    Category tab where the below formula is being used and where i'm stuck.

    =QUERY({IMPORTRANGE("KEYCODE","DataEntry!A2:D")},"Select * WHERE Col1 is not null and Col3='Bikini/Swimsuit Under 2' or Col4 = 'Bikini/Swimsuit Under 25'")
    upload_2018-4-11_14-57-16.png



    Appreciate all the help.
     
  2. neRok

    neRok Member

    Joined:
    Aug 19, 2006
    Messages:
    2,464
    Location:
    Perth NOR
    I'm not sure I understand. If you don't want #1-Butch to appear in the 2nd image, just remove `or Col4 = 'Bikini/Swimsuit Under 25` from your query.
     
  3. OP
    OP
    german

    german Member

    Joined:
    Nov 6, 2003
    Messages:
    936

    I'm wanting both to appear in the second image but only if "Bikini/Swimsuit Under 25" is selected.

    Instead of this.

    1, Butch, Female Fitness Model Novice - Short Bikini/Swimsuit Under 25
    3 Test Bikini/Swimsuit Under 25 Bikini/Swimsuit Under 25


    Should be this.

    1, Butch, Short Bikini/Swimsuit Under 25
    3, Test, 25 Bikini/Swimsuit Under 25


    Right now its bringing all data across from that query when it only needs to be number, Entrant and Div 1 or Div 2
     
  4. OP
    OP
    german

    german Member

    Joined:
    Nov 6, 2003
    Messages:
    936
    Have it worked out :)

    =QUERY({IMPORTRANGE("KEYCODE","DataEntry!A2:D")},"Select Col1, Col2, '"&B1&"' WHERE Col1 is not null and (Col3='"&B1&"' or Col4='"&B1&"') label Col1 '', Col2 '', '"&B1&"' ''")
     

Share This Page