So I'm trying to import data from two different google sheets into the same column. Since new data will be put into each column I have to import the whole thing. My problem is that I can just use two import ranges with a lot of empty cells between the relevant date, but no one wants that. After trying a lot and googling like made I came up with this:
=QUERY({IMPORTRANGE("https://docs.google.com/spreadsheets/d/1RwSw-JvLO3yqJxwQ9FBdfTcUjtSKlMMF3GF0Al-mGu8/edit#gid=286899333", "Sheet1!A1:A");IMPORTRANGE("https://docs.google.com/spreadsheets/d/1RwSw-JvLO3yqJxwQ9FBdfTcUjtSKlMMF3GF0Al-mGu8/edit#gid=286899333", "Sheet1!B1:B");},
"SELECT Col1 WHERE Col1 != ''")
But that also does not work. I set up an example sheet: https://docs.google.com/spreadsheets/d/1yr5f4eMsnbUuhzdCNQk2RkKmXoyU3WHhn1PBcWqZvgU/edit#gid=286899333
I hope someone here understands my problem and is able to help me.
Apply query to each sheet :
={QUERY(IMPORTRANGE("1RwSw-JvLO3yqJxwQ9FBdfTcUjtSKlMMF3GF0Al-mGu8", "Sheet1!A4:A"), "select Col1 where Col1 is not null", 0);
QUERY(IMPORTRANGE("1RwSw-JvLO3yqJxwQ9FBdfTcUjtSKlMMF3GF0Al-mGu8", "Sheet1!B4:B"), "select Col1 where Col1 is not null", 0);
QUERY(IMPORTRANGE("1RwSw-JvLO3yqJxwQ9FBdfTcUjtSKlMMF3GF0Al-mGu8", "Sheet3!A1:A"), "select Col1 where Col1 is not null", 0)}
try?
=QUERY({IMPORTRANGE("id", "Sheet1!A1:A");
IMPORTRANGE("id", "Sheet2!B1:B")},
"select Col1 where Col1 is not null", 0)
update:
=QUERY({IMPORTRANGE("1yr5f4eMsnbUuhzdCNQk2RkKmXoyU3WHhn1PBcWqZvgU", "Sheet1!A4:A");
IMPORTRANGE("1yr5f4eMsnbUuhzdCNQk2RkKmXoyU3WHhn1PBcWqZvgU", "Sheet1!B4:B");
IMPORTRANGE("1yr5f4eMsnbUuhzdCNQk2RkKmXoyU3WHhn1PBcWqZvgU", "Sheet3!A1:A")},
"select Col1 where Col1 is not null", 0)
or faster:
=QUERY({FLATTEN(IMPORTRANGE("1yr5f4eMsnbUuhzdCNQk2RkKmXoyU3WHhn1PBcWqZvgU", "Sheet1!A4:B"));
IMPORTRANGE("1yr5f4eMsnbUuhzdCNQk2RkKmXoyU3WHhn1PBcWqZvgU", "Sheet3!A1:A")},
"select Col1 where Col1 is not null", 0)
Related
I have a spreadsheet where users fill out a form, they have multiple options they can pick by clicking the checkboxes.
The responses sheets looks like this
I want to filter the results by option, so my main goal is to get the total amount of options selected:
I've been trying with COUNTIF but it's not working because I'm not selecting the specific response
=COUNTIF('Form Responses 1'!C2:F4,"*"&$B$1&"*")
I'm assuming I need to add a VLOOKUP but I'm not sure how to match it with the option
Here's a spreadsheet to play around with it
try:
=INDEX({QUERY(TRIM(SPLIT(FLATTEN(A2:A&"×"&SPLIT(B2:B, ",")), "×")),
"select Col1,count(Col1) where Col2 is not null group by Col1 pivot Col2 label Col1 'Person'");
{"Total", TRANSPOSE(MMULT(TRANSPOSE(QUERY(QUERY(TRIM(SPLIT(FLATTEN(A2:A&"×"&SPLIT(B2:B, ",")), "×")),
"select count(Col1) where Col2 is not null group by Col1 pivot Col2"), "offset 1", )*1),
SEQUENCE(COUNTUNIQUE(TRIM(FLATTEN(SPLIT(TEXTJOIN(",", 1, B2:B), ",")))), 1, 1, )))}})
Perhaps a formula like this:
=IFNA(QUERY({$A$2:$A$6, $B$2:$B$6}, "Select 1 where Col2 contains '"&B$9&"' and Col1 = '"&$A10&"' order by Col1 label 1 ''"), 0)
This outputs a 1 if the referenced cell contains the specified text, and a 0 otherwise. See the docs for the Query Function and the Query Language for more information.
Why this function does not display results for one of the ranges? With no QUERY the results are displayed correctly.
QUERY({
IMPORTRANGE("url";"Sheet1!A1:B5");
IMPORTRANGE("url";"Sheet2!A1:B5");
IMPORTRANGE("url";"Sheet3!A1:B5")};
"SELECT Col1, WHERE Col1 IS NOT NULL")
try:
=ARRAYFORMULA(QUERY(TO_TEXT({
IMPORTRANGE("url"; "Sheet1!A1:B5");
IMPORTRANGE("url"; "Sheet2!A1:B5");
IMPORTRANGE("url"; "Sheet3!A1:B5")});
"select Col1 where Col1 is not null"; 0))
So I have a timesheet for a project I'm working on, and I'd like to see how many hours I've worked by week.
I found an answer from this post: Create Weekly/Monthly/Yearly line chart in Google Sheets to sum amounts within same week/month/year range which got me really far.
Monthly and Yearly queries are working great thanks to user player0. However, weekly sorting is borked for me. The code I'm using now comes from that post:
=ARRAY_CONSTRAIN(ARRAYFORMULA(
IF(J2="Weekly", QUERY({"week "&WEEKNUM(A2:A)&" "&YEAR(A2:A), E2:E, YEAR(A2:A)+WEEKNUM(A2:A)*0.083},
"select Col1,sum(Col2),Col3 where Col2 is not null group by Col1,Col3 order by Col3 label sum(Col2)''", 0),
IF(J2="Monthly", QUERY({TEXT(A2:A, "mmmm")&" "&YEAR(A2:A), E2:E, YEAR(A2:A)+MONTH(A2:A)*0.083},
"select Col1,sum(Col2),Col3 where Col2 is not null group by Col1,Col3 order by Col3 label sum(Col2)''", 0),
IF(J2="Yearly", QUERY({YEAR(A2:A), E2:E},
"select Col1,sum(Col2) where Col2 is not null group by Col1 label sum(Col2)''", 0), )))), 999^99, 2)
Here's what the sheet looks like
I know very little about Google Sheets, so you'll have to keep it simple for me XD
try:
=ARRAY_CONSTRAIN(ARRAYFORMULA(
IF(J2="Weekly", QUERY(QUERY({"week "&WEEKNUM(A2:A)&" "&YEAR(A2:A), E2:E, "w"&YEAR(A2:A)&TEXT(WEEKNUM(A2:A), "00")},
"select Col1,sum(Col2),Col3 where Col2 is not null group by Col1,Col3 order by Col3 label sum(Col2)''", 0), "offset 1", 0),
IF(J2="Monthly", QUERY({TEXT(A2:A, "mmmm")&" "&YEAR(A2:A), E2:E, YEAR(A2:A)+MONTH(A2:A)*0.083},
"select Col1,sum(Col2),Col3 where Col2 is not null group by Col1,Col3 order by Col3 label sum(Col2)''", 0),
IF(J2="Yearly", QUERY({YEAR(A2:A), E2:E},
"select Col1,sum(Col2) where Col2 is not null group by Col1 label sum(Col2)''", 0), )))), 999^99, 2)
I currently have a database that looks like this:
But I would like for the output of the database to look like this:
I have tried using INDEX MATCH but I haven't been able to find a way to exclude blank values from the output.
A formula I have used but have not exactly returned the expected output is:
=INDEX('Input sheet'!B2:I7,0,MATCH(A2,'Input sheet'!A2:A7,0))
Is there a formula that can return non-blank values in a row, as shown on the output sheet?
https://docs.google.com/spreadsheets/d/1HdkBPhzB5oZ0RyKZzAOkPIXT81upgHiGBLfgXsrOZDI/edit?usp=sharing
=ARRAYFORMULA({UNIQUE(FILTER('Input sheet'!A2:A, 'Input sheet'!A2:A<>"")), TRIM(SPLIT(
TRANSPOSE(QUERY(IF(QUERY(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRIM(TRANSPOSE(QUERY(
TRANSPOSE(IF(LEN('Input sheet'!B2:J), "♠"&'Input sheet'!A2:A&"♦"&'Input sheet'!B1:J1, ))
,,999^99))),,999^99), "♠")), "♦")),
"select count(Col2) where Col2 is not null group by Col2 pivot Col1",0), "offset 1",0)<>"",
QUERY(QUERY(TRIM(SPLIT(TRANSPOSE(SPLIT(QUERY(TRIM(TRANSPOSE(QUERY(
TRANSPOSE(IF(LEN('Input sheet'!B2:J), "♠"&'Input sheet'!A2:A&"♦"&'Input sheet'!B1:J1, ))
,,999^99))),,999^99), "♠")), "♦")),
"select Col2,count(Col2) where Col2 is not null group by Col2 pivot Col1", 0),
"select Col1 offset 1", 0)&"♥", ),,999^99)), "♥"))})
REVERSE OF ABOVE:
=ARRAYFORMULA(TRANSPOSE(QUERY(SPLIT(TRANSPOSE(SPLIT(TRIM(QUERY(TRANSPOSE(QUERY(TRANSPOSE(
IF(LEN('Output sheet'!B2:F), "♠"&'Output sheet'!A2:A&"♦"&'Output sheet'!B2:F, ))
,,999^99)),,999^99)), "♠")), "♦"),
"select Col2,count(Col2) where Col2 is not null group by Col2 pivot Col1", 0)))
I've been trying to Consolidate the Data from multiple sheets using importrange.
This is the formula I have. The data of multiplesheets are first name, last name, department, branch and email address.
={IMPORTRANGE("File 1","Sheet1!A:Z");IMPORTRANGE("File 2","Sheet1!A:Z");IMPORTRANGE("File 3","Sheet1!A:Z");IMPORTRANGE("File 4","Sheet1!A:Z");IMPORTRANGE("File 5","Sheet1!A:Z")}
This is the formula that I am using but its not working.
any suggestion?
=QUERY({IMPORTRANGE("File1","Sheet1!A:Z");IMPORTRANGE("File2","Sheet1!A2:Z");IMPORTRANGE("File3","Sheet1!A2:Z");IMPORTRANGE("File4","Sheet1!A2:Z");IMPORTRANGE("File5","Sheet1!A2:Z")},"where Col1 is not null")
the same result, but if i tried to isolate each file individualy Its seems to be working without issue.
first, you need to paste each IMPORTRANGE formula separately and invoke #REF! error which will popup Allow access button. then you use a formula:
={QUERY(IMPORTRANGE("ID-or-URL-1", "Sheet1!A1:Z"), "where Col1 is not null", 0);
QUERY(IMPORTRANGE("ID-or-URL-2", "Sheet1!A1:Z"), "where Col1 is not null", 0);
QUERY(IMPORTRANGE("ID-or-URL-3", "Sheet1!A1:Z"), "where Col1 is not null", 0);
QUERY(IMPORTRANGE("ID-or-URL-4", "Sheet1!A1:Z"), "where Col1 is not null", 0);
QUERY(IMPORTRANGE("ID-or-URL-5", "Sheet1!A1:Z"), "where Col1 is not null", 0)}
={QUERY(IMPORTRANGE("ID-or-URL-1", "Sheet1!A1:Z"), "where Col1 is not null", 0)\
QUERY(IMPORTRANGE("ID-or-URL-2", "Sheet1!A1:Z"), "where Col1 is not null", 0)\
QUERY(IMPORTRANGE("ID-or-URL-3", "Sheet1!A1:Z"), "where Col1 is not null", 0)\
QUERY(IMPORTRANGE("ID-or-URL-4", "Sheet1!A1:Z"), "where Col1 is not null", 0)\
QUERY(IMPORTRANGE("ID-or-URL-5", "Sheet1!A1:Z"), "where Col1 is not null", 0)}