mercredi 31 juillet 2019

Google Sheet Function with IF statement to add 1/0 column

I want to query a number of rows from one sheet into another sheet, and to the right of this row add a column based on one of the queried columns. Meaning that if column C is "Il", I want to add a column to show 0, otherwise 1 (the samples below will make it clearer.

I have tried doing this with Query and Arrayformula, without query, with Filter and importrange. An example of what I tried:

=query(Data!A1:AG,"Select D, E, J, E-J, Q, AG " & IF(AG="Il",0, 1),1)

Raw data sample:

Captured Amount Fee     Country
 TRUE    336    10.04   NZ
 TRUE    37     1.37    GB
 TRUE    150    4.65    US
 TRUE    45     1.61    US
 TRUE    20     0.88    IL

What I would want as a result:

Amount  Fee     Country  Sort
 336    10.04   NZ       1
 37     1.37    GB       1
 150    4.65    US       1
 45     1.61    US       1
 20     0.88    IL       0

Aucun commentaire:

Enregistrer un commentaire