I have been using the sheet it was working good but suddenly my 5th column has become blank don't know how but tried to fix but failed
=QUERY(
{
importrange("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=492691616","Asim!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=420290061","Himani Ma'am!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=1739869159","Amar Sir!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=379284517","Prihaans Sir!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=1628909160","Awadhesh Sir!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=1178416768","Sudhir Sir!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=1834389652","Akash Sir!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=1314407625","Shahbaz!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=56464192","Rakesh!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=1717733476","Shreeneil!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=1206173219","Shubham!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=223854930&fvid=240899642","Paytm!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=961699629","Bank Transferred!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=495755553","Razor Pay!A2:J");
IMPORTRANGE("1vEK5DI4GSAWL-OIRP7iLFKyOJXZ6Iv_HV4OEiEgY-78/edit#gid=1432805879","Vinay!A2:J")
},
"select * where Col1 is not Null")
The query() function will only accept one data type per column. The column's type is determined by the majority of values within the first few hundred rows. Data that does not match the column's type will be returned as null.
If column E in the 'Asim' sheet is completely or almost completely blank, it is possible that the column type will be null, with the result that all data in column 5 of all the imported ranges will be returned as null.
You can check whether this is the case by filling column E in sheet Asim with some value like zero, the letter A, or =today(), depending on whether the column is supposed to contain numbers, text or dates.
Related
I'm trying to separate specific rows of data into a new sheet, based on the text string in Column H / 8;
=query({attendees_list!A2:N2},"select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14 where Col8='Show1 - Adult (Earlybird Pricing)'",1)
The query is working, in that it returns columns 1-14 from the 'attendees_list' sheet, but it doesn't seem to be applying the "where" condition, as its returning all rows regardless of the Column H value, rather than returning the specified value; 'Show1 - Adult (Earlybird Pricing)')
Here is a document with the example of the issue
https://docs.google.com/spreadsheets/d/1LEISiYnFeOloA5FDmzA3B5fhXVY_YJiivxedR5qurpU/edit?usp=sharing
I've tried different string quote types (ie; ''&"") but I can't figure out the issue.
Any idea where I'm going wrong here?
the issue is in the range A2:N2 <- that's one row and then 3rd query argument set to 1 will treat that single row as a header row and always output it whatever you setup in 2nd query argument
try:
=QUERY({attendees_list!A2:N},
"select Col1,Col2,Col3,Col4,Col5,Col6,Col7,Col8,Col9,Col10,Col11,Col12,Col13,Col14
where Col8 = 'Show1 - Adult (Earlybird Pricing)'", )
I'm trying to solve why one of the Google Sheets I maintain is failing to operate properly. I've isolated that the issue is with a query
QUERY(Import_MJL!A:BU, "select A where AJ> 0")
For reference the Import_MJL sheet is a static database. The AJ column holds a currency value. When performing an IF function of that column, it returns as TRUE as seen here
if(Import_MJL!AJ2 > 0,1,0)
What could be the reason that the query is not recognizing when my AJ Column is above 0 ?
Screenshot for bellow reference. Row 1 holds the code & row 2 holds the Results (The B2 Cell should result in an array whose length is over 10K but only returns the header. The Import_MJL!AJ2 cell has value 38K and should be a result of the cell on B2)
Screenshot of code and results
Thanks for the time y'all!
Chances are that Import_MJL!AJ2 does not contain a number but the text string $38,738.00 that only looks like a number. Many spreadsheet functions will automatically convert such values into numbers, but query() will not.
You can check whether a value is actually a number with the isnumber() function.
Here's a quick fix to try:
=arrayformula(
query(
{ Import_MJL!A1:AI, value(Import_MJL!AJ1:AJ), Import_MJL!AK1:BU },
"select Col1 where Col36 > 0",
1
)
)
I have a simple sheet to try to track and format race results from a league that I've joined. For the most part I know how I want to do this but when I use a query it's dropping data in some situations and formatting it strangely in others.
It seems as if where there are more numbers in a column than text it drops all text entries.
In addition for some reason when I add a check row, if it's included in the query it pushes almost all the data into a single cell except for the check row.
Would someone mind having a look and trying to figure out why it's doing this. Link Below
On sheet RRL1 I have my compiled data on the left, my 'missing' data on the right and my weirdly formatted data below.
https://docs.google.com/spreadsheets/d/1c9xlQG06dQCrpMk3UMAX29oTlpRuhTfx6btbYTGmC8g/edit?usp=sharing
The query() formula will only support one data type per column — number, text, boolean or date. The type is determined by the majority of the values in the first few hundred rows. Values that are of another type will be returned as null, i.e., blank values.
=QUERY('Tournament Details'!D2:E22)
Use an { array expression } like this:
={ 'Tournament Details'!D2:E22 }
=TRANSPOSE(query('Tournament Details'!I3:I26))
Use this:
=transpose('Tournament Details'!I3:I26)
Use this pattern to replace "DNS" and "DNF" with nulls:
=arrayformula(
query(
{ 'RRL1'!A1:C, iferror(value('RRL1'!D1:D)) },
"select Col3, sum(Col4)
where Col3 is not null
group by Col3
label sum(Col4) 'Total AUS RRL1' ",
1
)
)
The "squished" values you mention come about because you are not specifying the headers parameter. The best practice is to always include it, like this:
=query('Tournament Details'!A2:E22,"select A where C != 'N/A'", 1)
is there any query syntax that woks like coalesce in google sheets?
if i have a source like pict below
the result i want is only getting id and time if status is true, but the time is only exist in one col either in check column or report column
so the result would be like this...
I tired this but doesn't work
=QUERY(A1:D4, "SELECT A, COALESCE(B, C) WHERE D = TRUE")
any ideas or workarounds?
Thanks
try:
=ARRAYFORMULA(IFERROR(SPLIT(FLATTEN(QUERY(TRANSPOSE(
ARRAY_CONSTRAIN(IF(D2:D=TRUE, {A2:A, IF(B2:C="",,"×"&B2:C), D2:D}, ), 9^9,
COLUMNS(A:C))),, 9^9)), "×")))
A very short one just for the special case of 2 columns where you know that only one of them is populated and they are dates:
=ArrayFormula(to_date(if(D2:D,B2:B+C2:C,)))
Maybe the simplest formula which behaves like coalesce would be
=iferror(if(D2,hlookup(9^9,B2:C2,1,true),))
It's just a pull-down formula but will pick up the first non-blank column from a range of columns containing numbers or dates. If the columns are all blank, it returns blank.
You can take advantage of the either or situation and concatenate the 2 columns.
=filter({A2:A,concat(B2:B,C2:C)},D2:D)
Also see local array and filter
Add a column after Status call it Time (column E), whereas each formula follows this format (assuming your table starts at A3:E)
=if(A4="","",if(B4<>"",B4,C4))
Now query A3:E like so,
=query(A3:E,"Select A,E where D=TRUE")
you can use something like this:
=QUERY(transpose(B1:H1),"Select Col1 where Col1 is not null limit 1",0)
This transposes the row into a column, queries all non-null values from that column, and then set limit 1 to return the first value. So essentially you are selecting the leftmost non-empty value from your row.
I can't take full credit for this, I must have gotten it somewhere else... but it's in one of my sheets.
I attached a sample Google Sheet data (Link).
It contains 2 sheets. The Response sheet contains the response of the Google Form. Since the Google form has a lot of repeating questions, I have to transform the data using the Query function (sheet Transformed cell B2). The query command is
=QUERY(
{
Response!E2:H,Response!B2:D;
Response!I2:L,Response!B2:D;
Response!M2:P,Response!B2:D;
Response!Q2:T,Response!B2:D;
Response!U2:X,Response!B2:D;
Response!Z2:AC,Response!B2:D;
Response!AD2:AG,Response!B2:D;
Response!AH2:AK,Response!B2:D;
Response!AL2:AO,Response!B2:D;
Response!AP2:AS,Response!B2:D;
Response!AU2:AX,Response!B2:D;
Response!AY2:BB,Response!B2:D;
Response!BC2:BF,Response!B2:D;
Response!BG2:BJ,Response!B2:D;
Response!BK2:BN,Response!B2:D;
Response!BP2:BS,Response!B2:D;
Response!BT2:BW,Response!B2:D;
Response!BX2:CA,Response!B2:D;
Response!CB2:CE,Response!B2:D;
Response!CF2:CI,Response!B2:D;
Response!CK2:CN,Response!B2:D;
Response!CO2:CR,Response!B2:D;
Response!CS2:CV,Response!B2:D;
Response!CW2:CZ,Response!B2:D;
Response!DA2:DD,Response!B2:D
},
"select * where Col1 <> '' Order By Col6"
)
However when you look at the sheet Transformed, some data in Col F (Corresponding to Response sheet Col B) didn't get transferred. How could this problem be fixed?
Thanks in advance
It is often noted that users are tempted to mix data types within a column. The query() function will give undesirable output. If a column is intended for numeric values then only numerical values must reside in that column. Date columns must only contain dates and text columns only contain text values.
This does not mean that numbers cannot appear in a text column as long as they are in a text format.
Generally, the query() function will assume the greater number of cell types in a column to be that data type. For example, if there are 100 numbers and 20 text values in the same column then a numeric value will be assumed for that column. There is a good chance the text values will just be ignored. A slight change in your formula will convert all values to text.
See if this helps
=ArrayFormula(QUERY(to_text({
Response!E2:H,Response!B2:D;
Response!I2:L,Response!B2:D;
Response!M2:P,Response!B2:D;
Response!Q2:T,Response!B2:D;
Response!U2:X,Response!B2:D;
Response!Z2:AC,Response!B2:D;
Response!AD2:AG,Response!B2:D;
Response!AH2:AK,Response!B2:D;
Response!AL2:AO,Response!B2:D;
Response!AP2:AS,Response!B2:D;
Response!AU2:AX,Response!B2:D;
Response!AY2:BB,Response!B2:D;
Response!BC2:BF,Response!B2:D;
Response!BG2:BJ,Response!B2:D;
Response!BK2:BN,Response!B2:D;
Response!BP2:BS,Response!B2:D;
Response!BT2:BW,Response!B2:D;
Response!BX2:CA,Response!B2:D;
Response!CB2:CE,Response!B2:D;
Response!CF2:CI,Response!B2:D;
Response!CK2:CN,Response!B2:D;
Response!CO2:CR,Response!B2:D;
Response!CS2:CV,Response!B2:D;
Response!CW2:CZ,Response!B2:D;
Response!DA2:DD,Response!B2:D}),"select * where Col1 <> '' Order By Col6"))