Vlookup data greater than 0 only from two columns - arrays

On my first tab, I need to return the data from the second tab, columns A,B and C; only when the value of column A is greater than 0. I have pics to send but don't see a way to upload them. Currently using this formula, but have been unable to expand on it to get what I need.
=VLOOKUP('MSA Units'!A4, 'MSA Units'!A4:C882,1,FALSE)
I have also tried various forms of INDEX and MATCH arguments with no good results.
HERE IS REVISED LINK TO IMAGES: http://imgur.com/a/20J0v

Filter MSA Units and for columnA select all other than (Blanks). Copy ColumnsA:C of what remains visible into Daily Report Coversheet.

Related

How to add values in cells ONLY when other columns contain data from a query result

Link to example file:
https://docs.google.com/spreadsheets/d/1dCQSHWjndejkyyw-chJkBjfHgzEGYoRdXmPTNKu7ykg/edit?usp=sharing
The tab "Source data" contains the data to be used in the query on the tab "Query output". The tab "Desired result" shows what I would like the end result to look like.
The goal I'm trying to achieve is to have the formula in cell A2 on the tab "Query output" to populate the data in all four of the columns, so that it looks exactly like the "Desired result" tab. I know I can get the same result simply by entering additional formulas in C2 and D2, but this is not the objective, I need the results to come specifically from the single formula in A2.
The information in the "Additional data 1" column should simply repeat the word "Test" for every row that contains data in the first two columns. The information in the "Additional data 2" column should simply repeat the data from cell 'Source data'!A1 for every row that contains data in the first two columns.
Please feel free to edit the example file as it only contains dummy data. If you like, you can copy the tab "Query output" to create your own working formula for illustrative purposes.
EDIT:
I'm thinking along the lines of creating an array that consists of the required data for the columns "Additional data 1" and "Additional data 2" and then combining that array with the array of the query result which provides the first two columns. I've been experimenting with this in various ways, but so far the only result I have achieved is an error on the first cell of the query results. I also have no idea yet how I could make sure that the second array contains an equal amount of rows to the query result.
You can add static data into query:
=QUERY('Source data'!A3:B,"SELECT A,B, 'Test', '" & 'Source data'!A1 &"' WHERE A IS NOT NULL LABEL A '', B '', 'Test' '', '" & 'Source data'!A1 &"' ''")
Many thanks to #basic for the provided assistance! The insights were a great help to solving my issue. That said, I have muddled along a bit, and I've come up with a slightly different solution which I find better suited as it gives true blank values instead of a column filled with spaces.
First of all, instead of querying directly on the source data, I built an array and queried on that. I used the two existing columns (A and B) from the source data and added a third column to the array which does not exist in the source data. In order to make sure that the third column would consist of blank values, I used the IFERROR formula.
=IFERROR(0/0)
The formula above returns a blank because dividing by zero forces an error and the IFERROR method returns a blank unless an alternative return value is specified.
In order to be able to use this formula in an array however, it had to be tweaked slightly, because as it is it would only return a single blank cell value instead of a column of blank values. To do this, I used an already existing column from the source data, and then encapsulated it in an ARRAYFORMULA.
=ARRAYFORMULA(IFERROR('Source data'!A3:A/0))
Using this, the resulting array has the following formula.
=ARRAYFORMULA({'Source data'!A3:A,'Source data'!B3:B,IFERROR('Source data'!A3:A/0)})
This creates an array consisting of the two original columns A and B from the source data, plus an additional third column filled with blank values. This array can now be queried upon, and using the tricks previously provided by #basic the desired result as specified in the original question can be achieved.
Due to the query now being used upon a user-defined array, the columns in the SELECT statement now have to be referred to as Col1, Col2, Col3, instead of A, B, C. The final formula now looks like this.
=QUERY(ARRAYFORMULA({'Source data'!A3:A,'Source data'!B3:B,IFERROR('Source data'!A3:A/0)}),"SELECT Col1,Col2,'Test',Col3,'"&'Source data'!A1&"' WHERE Col1 IS NOT NULL LABEL 'Test' '','"&'Source data'!A1&"' ''")
I hope this information may prove of use to someone else as well.

Adding a header row between vertically joined queries (Or how to pad an array / create a fixed size array)

I am trying to make a google sheet that has a list of employees grouped by work area, where employees can be in multiple sections.
In our data structure we have a column G that is all the different groups they are approved to work in "Discord", "Live Monitoring", etc etc etc... That is just line feed separated text.
I have combined some queries like this that works from a data standpoint:
={QUERY('Active Unique'!A3:P,"Select * where G contains 'Discord'");QUERY('Active Unique'!A3:P,"Select * where G contains 'Live Monitoring'")}
I want a divider / header row between each query that just says "Discord", or "Live Monitoring". For it to work in this syntax the number of columns in that header has to match the return of the query (in this case the width of the sheet). I thought array_constrain would be my savior, but it only reduces the size of an array, it does not expand them.
I am thinking something like {"Discord","","",""....} at the start of each query with the number or columns equal to the width of the sheet. Easy enough to get with col(1:1) but I don't know how to construct a fixed size array or preferably how to pad one out. I could make a custom function for it. That is sort of the nuclear option and I would prefer not doing that so that the formula is more portable.
We currently have columns out to P in this sheet and it would be a visual nightmare to have a manually made array like that not to mention upkeep when a column is added to the source data.
Any ideas?
try:
=ArrayFormula({"Discord", IFERROR(COLUMN(B:P)/0)})

How to return an array matching a certain criteria in Excel?

I'm trying to parse an XML file in Excel, which is a Japanese dictionary. It contains several translations of each entry into different languages, and some entries have multiple translations per language. I want to write a formula that finds all of the translations by their language code, returns them as an array, and concatenates them using a TEXTJOIN formula. But I don't know how to go about this in Excel.
In Google Sheets, this would be easily solved by a FILTER function, but I can't use Sheets as there's too much data, and I haven't managed to get access to the beta FILTER function yet.
In the below picture, I'm trying to return the values in the <gloss xml:lang*> column, by searching for the values in the lang column. So for example, I want to return all values which have a "dut" next to them, and concatenate those into a single line using TEXTJOIN.
Any idea how I could go about doing this?
I fixed this by downloading the FILTER function. This is part of the Office Insider program, which releases Beta features if you choose to participate. You can access the Insider program by going to File > Account > Office Insider. Then to update your Office version go to File > Account > Office Updates to install the Insider update.
To filter the list by the "lang" column the formula looked like:
=FILTER([range in H column], [range in I column]=T$2)
I haven't specified either range because I used a formula-defined range using the INDIRECT function to avoid filtering through a million rows. The H range is what I want in the results of the filter, the I range is what I want to filter by - the "lang" code. T$2 represents the "lang" code, in this case "dut", and when I copy it across it will filter by each of the 8 lang codes in Row 2.
Then I used TEXTJOIN to combine it the array result into one column using the comma separator:
=TEXTJOIN(", ", TRUE, FILTER(...))

Excel: Array formula to return the column data that matches multiple criteria

I would like to submit an Excel problem I tried to solve for the past few days. I am not allowed to use macro, only formulas.
I have 3 tables (see link):
The first one (purple) contain a list of employees and their initials, no duplicates;
The second one (blue) is the main database (+ 500 columns), where all the employees codes are reported and each check mark (ΓΌ) represent the specific options related to that employee; this table is always modified (employees come and go, options are added, etc.);
The third one (Green) is the table that we need to make functional; when we select the name of an employee (yellow), it returns the matching initials (orange); we would like this table to automatically search the initials of the employee in the blue table heading and return the Codes that match the check marks in the respective column; I need a particular array formula to do so.
As you can notice, I calculated various formulas tests and, although I might be on the right path, I lack the necessary skills to create a complex formula that will return the matching codes of the preferences (check marks) from the array column. Does someone have an idea what should be modified to achieve this goal ? Thank you all for any solution you can propose.
Excel file

Create array with vlookup

I want to conditionally grab lines from a database-style spreadsheet in Google Spreadsheets (a list with a name, location, description, price) after checking the value with a vlookup - I've used this a while ago and expected it to CONTINUE an array across for the other columns next to the one 'looked up', but it seems my memory fails me here and it just retrieves the 'searched out' value.
=vlookup("Yes",'All 2014-15'!A2:G,2)
This formula basically finds the first value of the desired rows and should create a 'Selected items from 2014-15' list, but I can't work out how to expand it to produce a list of all the rows I want. Is there a simple way to retrieve this, I've tried playing with arrayformula but no success.
I can change the index simply to get the other values across, but if this could be filled out through an array too that would be preferable...?
Can you try this...
=FILTER('All 2014-15'!A2:G,'All 2014-15'!A2:A="Yes")
Edit:
As suggested by Immx, added apostrophes to sheet name and the second range changed to A2:G to A2:A assuming the yes/no data is in A column.

Resources