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)}
Related
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)
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 have a range of data which I need to filter by non-empty cells within a specific sub-range, while generating a new row for each non-empty cell within that sub-range.
Observe the following example sheet, containing input data and desired output:
https://docs.google.com/spreadsheets/d/1c1lOtXpGbY9MwYHEoFIe1fxgW7TnygcgImCIIp2gzqM/edit?usp=sharing
For each "Type 1 - 4" cell that is not blank, a new row should be output containing the date, name, type and value from the input row.
What formula or functions are needed in order to accomplish this?
I am not new to using QUERY, VLOOKUP, and FILTER, and yet am unable to achieve the desired output via formula, nor even come up with anything that begins to get close.
=ARRAYFORMULA({"Date", "Name", "Type", "Value"; QUERY({
QUERY({B3:I, IF(F3:F<>"", $F$2, )},
"select Col1, Col2, Col9, Col5 where Col9 is not null", 0);
QUERY({B3:I, IF(G3:G<>"", $G$2, )},
"select Col1, Col2, Col9, Col6 where Col9 is not null", 0);
QUERY({B3:I, IF(H3:H<>"", $H$2, )},
"select Col1, Col2, Col9, Col7 where Col9 is not null", 0);
QUERY({B3:I, IF(I3:I<>"", $I$2, )},
"select Col1, Col2, Col9, Col8 where Col9 is not null", 0)},
"select * order by Col1 asc", 0)})
An alternative answer, similar to player0's in concept, but a bit simpler. It selects columns after the full array of ranges has been formed:
=arrayformula(
query(
{
B2:B, C2:C, iferror(F2:F/0, F2), F2:F;
B2:B, C2:C, iferror(G2:G/0, G2), G2:G;
B2:B, C2:C, iferror(H2:H/0, H2), H2:H;
B2:B, C2:C, iferror(I2:I/0, I2), I2:I
},
"where Col4 is not null
order by Col1",
0
)
)
Via Google Product Forum.