VLOOKUP + QUERY + IMPORTRANGE > import all lines with condition true - google-sheets

Following this question IMPORTRANGE + extra column does not behave as table, I read about the VLOOKUP+QUERY+IMPORTRANGE
other questions and decided it was a good way to use an index to store
lines without breaking the logic of the other sheets.
I am using a combined VLOOKUP + IMPORTRANGE to copy original data to a viewer sheet. I have the lines imported correctly, matching their index, but I needed the condition that only checked lines in the original data sheet should be imported to the viewer SS.
The Viewer SS then presents a copy of the datas and will also use checkboxes to select and show some data in another sheet. Thus, I needed the index to keep the order in the table and not mess this final step.
This shows the lines with matching index ( I do not have the checked condition): =IFERROR(arrayformula(VLOOKUP($A$3:$A$1001;IMPORTRANGE($A$1;"DataSorts!B2:S1000");2;false));"")
This gets only the lines where a checkbox (Col1) is checked in the original data sheet :
QUERY(IMPORTRANGE(A1;I1);"select Col3, Col4, Col5, Col6, Col7, Col8, Col9, Col10 where Col1='TRUE'";1)
You can find an exemple of the logic here : https://docs.google.com/spreadsheets/d/1qBGkWETY2fcUks2gsPgeRSaG_RuFkOmik0_WKNs1nUQ/edit?usp=sharing
Be aware that I put the original data example in the same SS, for simplicity. I'll use an IMPORTRANGE in the QUERY or the VLOOKUP to get the real datas, whichever is the best solution.
Thanks a lot for the help !

try in C2:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A10;
QUERY({IMPORTRANGE("1qBGkWETY2fcUks2gsPgeRSaG_RuFkOmik0_WKNs1nUQ"; "Data (Edit)!A2:D10")};
"select Col2,Col1,Col3,Col4 where Col1=TRUE"; ); {3\ 4}; )))

Related

Attempting to Merge data and sum up the similar items. After a Filter/Sort within Google Sheets

Currently working on a project where im trying to Filter out and Sort out data from one list based on a dropdown menu. When the data gets pulled from the other list into a better readable format, it brings along some duplicate item names due to being listed seperately based on SKUS, is there any way i can SUM the total qunatities together, and have just 1 name within that list via Functions?
my current function is
=SORT(FILTER('Month of Detailed Manifest Report'!B2:D, 'Month of Detailed Manifest Report'!A2:A = A3, 'Month of Detailed Manifest Report'!B2:B <> "SAMPLES"),1,True)
Brings my data up like this.
You can see how it adds Duplicate Data Here
Just trying to get it so it merges the similar names and adds the Qty's together so i can get a better accurate data pull of information.
See my comment to your original post. That said, just eyeing it here and without the ability to test it, you can try this formula:
=QUERY({'Month of Detailed Manifest Report'!A2:D},,"Select Col2, Col3, SUM(Col4) WHERE Col1 = '"&A3&"' AND Col2 <> 'SAMPLES' GROUP BY Col2, Col3 LABEL SUM(Col4) '' ORDER BY Col2")
In theory, that should work.
If not, as I invited in my previous comment, share a link to a copy of the spreadsheet.

Array Vlookup Importrange to get the Data from different Sheet

I am using below formula which is working very fine. But it is just loading the single column Data which is Column W3:W500 I want to get the other columns Data as well that are X, Y, Z and AA, AB.
I tried by expanding this range W3:W500 to W3:AA500 but nothing worked. Your help will be appreciated.
Formula Sheet
Data Sheets
=ArrayFormula(IF(B3:B501="",,vlookup(trim(B3:B501&" "&C3:C501&" "&text(F3:F501, "mm/dd/yyyy")&" "&G3:G501), {transpose(QUERY(TRANSPOSE(query(IMPORTRANGE("Sheetname","Sheet1!A3:W500"), "Select Col2, Col3, Col6, Col7")),,9^9)), IMPORTRANGE("Sheetname","Sheet1!W3:AA500")} ,2,0)))
You only requested column 2 to be returned at the end of your VLOOKUP, i.e., ,2,0).
See the newly added "Erik Help" sheet, where I replaced your 2 (ie., your request for only the second column of data) with {2,3,4,5} (i.e., a request for columns 2, 3, 4 and 5 of data).
I'm confused, however, as to why you are requesting A3:W500 in your first IMPORTRANGE call, if you only need the data from A3:G500; and likewise, why you are calling for W3:AA500 in the second IMPORTRANGE, if you only need W3:Z500.

How to add extra text to Query results?

I have a sheet with data that a Google Form is continually adding data to. Once the data is added, there is a subset that I need to have sectioned off to another sheet.
I'm transposing the data so it sorts vertically for each Form's data, and the problem I'm running into is that I want each vertical selection to be individually labeled with the same consistent labels and I don't think I can make CONCATENATE work in this case (I would love to be proven wrong!).
Here's a link to the sheet:
https://docs.google.com/spreadsheets/d/1efOQRlKaJlffMnLd8f8oPZxJ57wVFGwKwVY3UW0savc/edit?usp=sharing
Here's the formula I currently have in A1 on the 'Credential Request Form' sheet:
=TRANSPOSE(QUERY('Onboarding Form Responses'!A2:J,"Select F,B,C,D,G,A where A is not null order by A desc"))
This presents the data I want and in the order I want it, but without labels before the data (sorry, "label" might be the wrong word here). I've included an example of how I'd like the data to present in cells A9:A13 on the same sheet.
Is it possible to add those labels without a substantial amount of scripting?
No scripting needed.
You can use a similar formula for your needs:
=TRANSPOSE(query(ARRAYFORMULA({"Employee Name: "&'Onboarding Form Responses'!B2:B,
"Store Number: "&'Onboarding Form Responses'!F2:F,
"Parking Space: "&'Onboarding Form Responses'!G2:G}),
"Select Col1, Col2, Col3 where Col1 is not null order by Col1 desc"))
Notice that we use "Employee Name: "&'Onboarding Form Responses'!B2:B etc. for our ranges and then Col1, Col2, etc.

Google sheet query / filter with columns not Blank

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]))

Pivoting programatically and carrying color information in summary of Google sheets

We have a base table that looks like this, in our main sheet called "MainData".
We would like to summarize it in a new worksheet. The summary needs to be by time, in a program management mode, where the "When" becomes the main view, in the following way. We could technically get a version of the top part of the table via Pivot, but that forces a new worksheet. We would like this entire view to be in our own second sheet of choice which we can call "Summary".
Not sure where to begin with this. The GETPIVOTDATA command seems a more convenient way to control how the pivot shows without forcing a worksheet, but it's the itemization of colours etc that is confusing. In each week's listing below that week column, we'd like to show the items but their cell needs to be coloured by the Status that item is in.
Not looking for ready made solutions (although I won't revolt if that's shared), just looking for pointers for which functions to look for. Thanks muchly!
Solution:
It's quite a task... :)
I have build working solution for you.
Go to this link to grab this (2 sheets - data and report)
Explanation:
Data sheet:
I added an extra column to source data - we will need this column in further query (you can hide this column)
={"Rep Desc";ArrayFormula(if(A2:A<>"";"Count of "&A2:A;))}
Report sheet:
I added 2 extra columns (A:B) (you can hide them later) to explain better what is going on. There are 4 main parts to this solution - you are able to pack all of them into one formula, but for sake of clarification I left them separate.
Part 1 Numbers of "Open / Closes / Attn"
This is simple query - we use extra column in data source to have desire description (Count of... instead just Attn, Closed, etc)
=QUERY({INDIRECT($A$1)};$B$1;1)
string to query
select Col5, count(Col4) where Col1 is not null group by Col5 pivot Col3 label Col5 ''
Part 2 - "Sum of Point"
Its Query again put into next query to remove headers + "Sum of Points" as an extra column (using inline array - {}):
={"Sum of Points"\QUERY(QUERY({INDIRECT($A$1)};B5;1);"select * offset 1";0)}
string to query
select sum(Col4) where Col1 is not null pivot Col3
Part 3 - "Features"
It is quite complicated... If I find more time I will describe what is going on here... but for now just code:
=QUERY(
transpose(ArrayFormula(SPLIT(
transpose(SPLIT(
TEXTJOIN("^";1;transpose(
{SPLIT(join(" ## ";transpose(query(transpose(QUERY({INDIRECT($A$1)};$B$9;1));"select Col1 offset 1";0)));" #";0;1);
QUERY(ArrayFormula(IF(TRANSPOSE(query(transpose(QUERY({INDIRECT($A$1)};$B$9;1));"select * offset 1";0))<>"";
query(QUERY({INDIRECT($A$1)};$B$9;1);"select Col1";0);""));"select * offset 1";0)}
))
;"# ";0;1))
;"^")))
;
"select * offset 1";0)
Part 4 - Conditional formatting
For range D9:H apply 3 rules with corresponding color :
=INDEX(INDIRECT("data!$A:$A");MATCH(D9;INDIRECT("data!$B:$B");0);1)="Open"
=INDEX(INDIRECT("data!$A:$A");MATCH(D9;INDIRECT("data!$B:$B");0);1)="Closed"
=INDEX(INDIRECT("data!$A:$A");MATCH(D9;INDIRECT("data!$B:$B");0);1)="Attn"
OK?
Is that what you were going to achieve?
Again - this is working copy for you:
Go to this link to grab this (2 sheets - data and report)

Resources