I have 50 sheets representing 50 states in a single Spreadsheet, and of those states, I'm trying to consolidate from an input column (Col4 on all sheets, Column 'City' formatted like this: 'Austin, TX') into a single index column to pull from to build a City-plotted map. (I'm using Marker Maps in Google Sheets for this).
However, I keep running into errors trying to accomplish this task.
I've used =QUERY() to pull in 2 sheets (2 sheets to make it easy).
=QUERY({AL!D2:D10; AK!D2:D10},"SELECT * WHERE Col4 > 0")
However, I get a
'Query Completed with an empty output' Error.
=QUERY({AL!D2:D10; AK!D2:D10},"SELECT *")
Works, but I'm only getting the AL city results pulled in, 'Auburn, AL' but no 'Anchorage, AK'.
I've tried varying Select statements to see if it would work, but I cannot get more than a single sheet's Column pulled in.
If anyone has any better suggestions on how to do this, or have an idea why I'm receiving errors or doing it wrong, please assist.
you need to do it like this:
=QUERY({AL!D2:D10; AK!D2:D10}, "where Col1 is not null", 0)
Related
so I have 5 separate google sheets, each one with the same title and format enter image description here.
There are 8000-10000 rows each so far, as it's a daily sales updating data, yearly may finish with 20000-40000 rows each.
So what I want to do is to merge all of them into another single sheet, and I've tried the following formulas:
enter image description here
Formula A
={IMPORTRANGE(B2,C2);IMPORTRANGE(B3,C3);IMPORTRANGE(B4,C4);IMPORTRANGE(B5,C5);IMPORTRANGE(B6,C6)}
Results:
#VALUE!
"In ARRAY_LITERAL, an Array Literal was missing values for one or more rows."
Formula B (reduced the data to only one month)
=QUERY({IMPORTRANGE(B2,C2);IMPORTRANGE(B3,C3);IMPORTRANGE(B4,C4);IMPORTRANGE(B5,C5);IMPORTRANGE(B6,C6)},"SELECT * Where Col2 > DATE'2022-5-1' AND Col2 <= DATE'2022-5-31' ",0)
Result:
#VALUE!
"In ARRAY_LITERAL, an Array Literal was missing values for one or more rows."
Formula C (check if is the problem of the code)
={IMPORTRANGE(B2,C2);IMPORTRANGE(B3,C3)}
Results:
It works.
So my question is that, there is anyway via google sheet let me merge all the 5 sheets in one (5sheets*40000rows into one sheet) , or it's not the place to manage that volumn of data?
every importrange needs to be run separately before you use it in your joint formula. the array error you are getting is a result of some importranges importing those 7 columns and those importranges that are not connected output one single cell. make sure you allow access to all your importranges.
I have a CSV file that I'm pulling from a database. It's in an awkward layout so I need to reorganise it and display the result in a separate sheet.
Here is a dummy example of the data structure I get.
https://docs.google.com/spreadsheets/d/1sTfjr-rd0vMIeb3qgBaq9SC8felJ1Pb4Vk_fMNXQKQg/edit?usp=sharing
It looks like that. The database grows every day by date and sometimes countries so I need to account to that in my formula.
I need to pull data per each country and display it by date.
I don't need data from Column A, C and D. And when there are multiple states I need to sum them up in one column.
It should look like this and keep growing downwards. I'm gonna use this table for a graph chart
What I've tried so far
=TRANSPOSE(QUERY(IMPORTRANGE("url_to_a_separate_sheet_where_I_importing_a_row_csv_file", "CSV-source-sheet!A1:500"), "SELECT * WHERE Col2='Germany'"))
This works, kinda. But pulls in unnecessary columns and I can't figure out how to sum countries with multiple states. When I add select sum(*) it gives me a big and long error. I assume it might be because of unnecessary columns that the formula cant sum up and I don't know how to omit them. I'm stuck
I tried offset and skipping no luck. Any ideas?
try:
=ARRAYFORMULA(TRANSPOSE(QUERY({Sheet2!B:B, Sheet2!E:BE},
"select Col1,"&TEXTJOIN(",", 1,
"sum(Col"&ROW(INDIRECT("Sheet2!A2:A"&COUNTA(Sheet2!1:1)-5))&")")&"
where Col1 is not null
group by Col1
label Col1'Date'", 1)))
spreadsheet demo
I am encountering a capacity issue with one of my spreadsheets but certain information in the sheet still needs to be available to cross-reference. The original spreadsheet contains this formula:
=sumif(A:A,A2,N:N)=O2
I tried to do a direct transfer to the new spreadsheet by adding importranges like this:
=SUMIF(IMPORTRANGE("URL","Sheet1!A2:A"),IMPORTRANGE("URL","Sheet1!A2"),IMPORTRANGE("URL","Sheet1!N2:N")=IMPORTRANGE("URL","Sheet1!O2")
The equation keeps putting out an error saying "argument must be a range". Then I tried to write it out as a query like this:
=QUERY(AND(IMPORTRANGE("URL","Sheet1!A:A"),IMPORTRANGE("URL","Sheet1!N:N"),"SELECT SUM(CASE WHEN Col1=A2 THEN Col14)=O2"))
But the equation is showing FALSE as the result when it should say TRUE. I have attached an example spreadsheet so that these equations make more sense.
I also need the equation to take into account any new information that is placed on the new spreadsheet while also comparing it with the old info. I tried doing this to start with but then slowly realized the initial equation itself doesn't work.
=SUMIF(IMPORTRANGE("URL","Sheet1!A2:A"),IMPORTRANGE("URL","Sheet1!A2"),IMPORTRANGE("URL","Sheet1!N2:N"))=IMPORTRANGE("URL","Sheet1!O2")+SUMIF(A:A,A2,N:N)=O2
Any help is appreciated.
https://docs.google.com/spreadsheets/d/1q1cWh58p23dcQulQ4rz6v4iiDywEFHvcrvASao61xxo/edit#gid=0
use this formula instead of SUMIF:
=ARRAYFORMULA(IF(LEN(
IMPORTRANGE("1q1cWh58p23dcQulQ4rz6v4iiDywEFHvcrvASao61xxo","Sheet1!C2:C")),
IF(IFERROR(VLOOKUP(
IMPORTRANGE("1q1cWh58p23dcQulQ4rz6v4iiDywEFHvcrvASao61xxo","Sheet1!C2:C"),
QUERY(IMPORTRANGE("1q1cWh58p23dcQulQ4rz6v4iiDywEFHvcrvASao61xxo","Sheet1!A2:N"),
"select Col3,sum(Col14) where Col1 is not null group by Col3 label sum(Col14)''"),2,0))=
IMPORTRANGE("1q1cWh58p23dcQulQ4rz6v4iiDywEFHvcrvASao61xxo","Sheet1!O2:O"), TRUE, FALSE),))
I'am working on some document which get data from Non Google form, and the output is 36 column but there will be always filled up 8 max 9 columns with empty columns in between, with our Form we CANT change way how data are outputed. Empty column are here cuz Client fill up specific type of order so data are put in specific column.
i need query for pulling data from the main sheet and output just specific 5 specific column ( those will be always in same place ), and 2 columns that can be anywhere in between.
writing down every single column is not perfect as i need to pull data row by row not all at once ( i will be adding data in between final query output) and with that it would drasticly slow down file with few hundreds inputs added per week.
I didnt found working way to combine filter and query together to do this job ( removing empty columns [ <>'' and is not null].
Could someone help me with this ?
providing link for file : https://docs.google.com/spreadsheets/d/1SDR939yUSq9trLcxBid9AQeZUn-lNNiRr7O7pDiu888/edit?usp=sharing
In cell M1 of your sheet 'Desired output' try entering this little monster
=Arrayformula(query({'Raw data'!A:Z\
{"Configurable list"; 'Raw data'!D2:D&'Raw data'!F2:F&'Raw data'!H2:H&'Raw data'!J2:J&'Raw data'!L2:L&'Raw data'!P2:P&'Raw data'!R2:R&'Raw data'!T2:T&'Raw data'!V2:V}\
{"Date"; ('Raw data'!E2:E&'Raw data'!G2:G&'Raw data'!I2:I&'Raw data'!M2:M&'Raw data'!O2:O&'Raw data'!Q2:Q&'Raw data'!S2:S&'Raw data'!U2:U&'Raw data'!W2:W)+0}};
"Select Col1, Col2, Col3, Col26, Col28, Col24, Col27 Where Col1 is not null format (Col28) 'dd.mm.yyyy'"))
See if that works for you?
Your answer is really in the heading. You can use =filter([Range], [Range]<>"") for each row to get to this in the desired output. The filter function is perfect for this application.
UPDATE:
Looked at your sheet to get a better view of the problem. You'll need some wildcard workaround as shown here as a second criteria to identify the Date & Configurable cells: =filter([Range], [Range]<>"", search("Date", [Top row]))
I would like to aggregate the data of multiple spreadsheets into one spreadsheet.
Spreadsheet 1 has a Row of Strings A2:A500
Spreadsheet 2 has a Row of Strings A2:A500
Spreadsheet 3 is supposed to have a Row of both (Spreadsheet1!A2:A500 AND Spreadsheet2!A2:A500).
Duplicates shall not be handled differently. I would like them to appear as often as they appear in the different sheets.
Is it possible to do this without writing a script or using jQuery, e.g. by using IMPORTRANGE?
What does not work: I have tried using IMPORTRANGE as follows:
ARRAY{IMPORTRANGE("key-of-spreadsheet1","list!A2:A500"), IMPORTRANGE("key-of-spreadsheet2", "list!A2:A500")}
This causes an error.
You should be able to use a vertical array in the Spreadsheet 3:
={IMPORTRANGE("Sheet1Key","SheetName!A2:A500");IMPORTRANGE("Sheet2Key","SheetName!A2:A500")}
Of course, it is also possible to combine several IMPORTRANGE() functions with the QUERY() function, which gives us a greater control over the results we import.
For example, we can use such a construction:
=QUERY(
{
IMPORTRANGE("key-or-url-of-spreadsheet-1", "'sheet-name-1'!A2:Z100");
IMPORTRANGE("key-or-url-of-spreadsheet-2", "'sheet-name-2'!A2:Z100");
IMPORTRANGE("key-or-url-of-spreadsheet-3", "'sheet-name-3'!A2:Z100");
IMPORTRANGE("key-or-url-of-spreadsheet-4", "'sheet-name-4'!A2:Z100")
},
"SELECT * WHERE Col1 IS NOT NULL ORDER BY Col3 ASC"
)
###Explanation:
The above query removes blank lines from imported ranges:
SELECT * WHERE Col1 IS NOT NULL
and sorts ascending all data collected together in relation to the third column:
ORDER BY Col3 ASC
For descending, just use DESC in place of ASC.
Of course, we can also arrange any other criteria, or omit them displaying everything without modification:
"SELECT * "
###Note:
In order to use the above constructed query, we first need to call a single IMPORTRANGE() method for each of the spreadsheets we want to refer:
=IMPORTRANGE("key-or-url-of-spreadsheet-1", "'sheet-name-1'!A2:Z100")
We have to do this even if we refer to the same spreadsheet in which we write this formula, but for every spreadsheet it is enough to do it once.
This is to be able to connect these sheets and allow access to the sheets (to which we have the access rights anyway):
After giving permission for all spreadsheets, we can use the above query.
I am also applying above given formula for getting data from multiple spreadsheet which is getting an error something is like IN ARRAY_LITERAL An array literal was missing values for one or more rows.
Easy fix: Apply the filter to the entire column / sheet instead of just the current selection. This will automatically update all of the filters to include new additions.