Filter Data for Each Row in a Column - filter

EVE Online Manufacturing Spreadsheet
In Batch!F3:G, I'm attempting to break down the data input from columns B3:C to their components (and eventually materials/minerals in I3:J) by using filter to compare results in Engine!P:R. Multiplied of course by the total number of each finished product I need.
I've been trying to figure out ways to arrayformula this together, and even tried quite a few query functions without success. The best I've been able to come up with is to string the actual formula together, appending them with {}, but this gets bloated quickly. I need this to be open ended because I have a tendency to build a lot of things at once. Any help would be appreciated, even just point me in the right direction!

Well, based on my limited knowledge about google sheet, I can only think of one way to do this automatically.
Here's a sheet I constructed based on your sheet.
https://docs.google.com/spreadsheets/d/1AfX8o05gUGPiN5S90w4o0yxuIYjsJRaXsaYUFTJuEPo/edit?usp=sharing
First, on Engine sheet, add one more column which will give you the number of materials required for that part, which is looked up in the PART LIST of BATCH sheet. For this I use VLOOKUP, as you see in D2.
Then on BATCH sheet, query the materials that VLOOKUP return positive, multiply it by the amount of item and then sum them.
This is done by the QUERY used in F3
This method only if you don't have duplicate item in your PART LIST, due to the way VLOOKUP work.
Of course if you want to break the material list further, you can do the same approach..

Related

(Google Sheets) How to remove certain dropdown options after a certain number of cells with said option is met?

I'm currently working on a google sheets file to organize the members of my class. I am currently assigning committees and I want them to choose their committee in Google Sheets. However, I want to apply only a certain limit per committee.
What I want to happen is, if a certain choice has been chosen i.e. 5 times, I would like that choice to disappear from the choices and would make it reappear again if ever a students change their choice, however, I do not know how to do this in terms of a formula or through data validation.
I would really appreciate your help. Thank you!
Here's a toy example you may be able to adapt to your needs:
Create a list of options a,b,c,d,e in A1:E1 of Sheet1
Create a list of the limits for each option in A2:E2 (for instance 2,1,3,5,3)
Create a list of people Person1,Person2,Person3 in G2:G4
Apply data validation to H2:H4:
Use criteria 'drop down (from a range)'
Set the data range to =Sheet1!$A3:$E3 (only lock columns, not rows)
In A3 enter the following formula:
=lambda(people,choices,list,limits,
makearray(counta(people),counta(list),lambda(r,c,
if(index(choices,r)<>index(list,,c),if(countif(choices,index(list,,c))<index(limits,,c),index(list,,c),),index(list,,c)))))(
$G$2:$G$4,$H$2:$H$4,$A$1:$E$1,$A$2:$E$2)
We are using MAKEARRAY to create a 2D array with the list of options on each line, however we are asking it to omit elements of the list from each line if they haven't already been selected AND a preset limit on the number of selections for that option has not been reached. Obviously in a 'real' example you would place the data range for validation in a separate sheet and probably hide and protect that sheet as well. You could also potentially use an array literal of strings rather than a cell range as the list of options in order to make the validation list formula completely self-contained.

Google Sheets Query Sorted Results

I am writing a query function that I would like sorted. I have this figured out. What I cannot solve is attempting to insert 2 blank rows between the sorted results. Is this at all possible? Here is my query as it currently stands. Works perfectly as written. Just would like to have a 2 row gap between results.
Thank you.
=query('Form Responses 1'!A:CM,"Select B,C,D,I,L,AU,AX Where K = '"&Titles!B2&"' OR AW = '"&Titles!B2&"'Order by K,AW",0)
enter image description here
Since you've clarified your question to say that you want two blank rows, only to be added at a specific point in your query results, I've created another answer. But you haven't answered my question about what criteria you have for deciding where to insert these two lines, so I've made an assumption based on your data. This formula should be easily adapted if you have some other criteria for where to insert the blank lines. See my added tab HelpGK in yur sample sheet.
Try this formula, where you have your query:
={query('Data Sheet'!A:J,"Select B,C,D,E,F,H,I Where E='' and (G = 'ABC' OR J = 'ABC') Order by J,G",0);
{"","","","","","",""};
{"","","","","","",""};
query('Data Sheet'!A:J,"Select B,C,D,E,F,H,I Where E<>'' and (G = 'ABC' OR J = 'ABC') Order by J,G",0)}
Note that I don't believe your exact Desired Result can be obtained from your Data sheet. You are missing data rows. But this formula produces the result in the screenshot you provided.
EDIT:
Just realised that I created an answer for a single column of data.
Please share a sample sheet since this is not your case.
You can try this formula, but you'll need to replace this text "A4:A8" with your exact query:
=ArrayFormula(flatten(split(A4:A8 & "♥ ♥ ","♥",0,0)))
Note that the column with the "~" values in the blank cells is just to demonstrate what is happening.
If you had provided a sample sheet, with sample data, it would have been easier.
Let me know if this works for you. If not, please provide a sample sheet, with sample data, and let us know what else you need.
Be aware that the you can't put any values into the two inserted rows of blank cells, or the arrayformula will fail. But if you are planning to save the results of this as values, then pasted into place, then you could overwrite the blank cells, if desired.
Also be aware that FLATTEN is an undocumented function, and may possibly be removed from Sheets. If this is for a critical application, and alternative formula can be provided. Let us know if that is a concern.
I will delete my earlier answer, which mistakenly focused on a one column result.
This messy formula seems to handle multiple columns. If it works for you, I'll see if I can simplify it or clean it up. I can also provide details of the steps it is doing, if necessary. Replace the text "A4:C8" in this formula with the range where your query result currently exists. Once you've tested that, you can replace the text "A4:C8" with your actual query statement, to have everything done in one formula, if you want.
=ARRAYFORMULA(SUBSTITUTE(SUBSTITUTE(SPLIT(FLATTEN(ARRAYFORMULA(SPLIT(TRANSPOSE(ARRAYFORMULA(QUERY(TRANSPOSE(ARRAYFORMULA(SUBSTITUTE(A4:C8," ","♥"))),,99^99)&"♦~♦~")),"♦",1,0)))," ",1,0),"~",""),"♥"," "))
Please let me know if this works for you. If you have any issues, please share a sample sheet, with only sample data, and clarify what isn't working as you expect.

Google Sheets split words then sort Alphabetically, Using arrayformula

I have multiple rows, containing varying number of cells, and in each cell I have one or more words.
I'm looking for a way to go row by row:
Splitting the multiple words into single word parts (with space (" ") as the delimiter)
Sort the parts alphabetically
Put the parts back into multiple word cells
Remove duplicates in the row
Already the first, seemingly easy part, gave me issues. Even if I just tried to look at one row, the closest I got was the code below and that inserted strange " " for the one word cells, and also failed to sort
=iferror(arrayformula(transpose(sort(transpose(SPLIT(transpose(B3:3)," "))))),"")
1
I also tried to cut, sort and join the above output using the Query Header trick, but it refuses so sort anything but the first row
=arrayformula(trim(transpose(query(SORT(transpose(B12:D)),,COLUMNS(B12:D)))))
2
I haven't even attempted combining the two things together, considering my epic fails above.
The final input document will have lots more rows and columns, so I also need to make sure this works without any hard coding of row or column numbers.
Any and all help would be greatly appreciated.
I might have something for you. It's a little bit of an odd way to do it, but it could work I think.
Take a look at this sheet.
The original data is in the Original tab in cells B3:J, all the way down.
The Converter tab puts every thing in one column, then there is a "dragdown formula" that'd need to be dragged down a long ways depending on how big your data set it is. The good news is that you can just do it for thousands of rows beforehad and it will remain blank.
the New Data tab has just one formula and will repopulate your data the way it was, but with the resorted words.
Try messing with the data on the Original Data tab as much as you want. see if New Data reflects what you'd want.

Excel 2017 Formula - Average data by month, while being filterable

I'm not a VBA coder, and I would prefer an excel formula if possible, the easiest solution will be the best one.
Test workbook screenshot
As you can see, I have plenty of columns, which are filterable.
I am attempting to retrieve an average of Column L, but I want the data to be calculated for the correct month in G3:R3.
The resulting calculation needs to be recalculated when filtered, between customers, sites, status, job type etc.
I am referencing the resulting cells in another sheet, which gives an idea of trends I can glance at, as such filtering by month in each sheet, is not an option.
=AVERAGE(IF(MONTH(E9:E1833)=1,(J9:J1833)))
This one does not update with the filtered data.
=SUM(IF(MONTH(E9:E1833)=1,J9:J1833,0)) /SUM(IF(MONTH(E9:E1833)=1,1))
This one does not update with the filtered data.
I have tried 5 different SUBTOTAL formulas, some with OFFSET, none of these produce the same result I get when checking manually.
Each worksheet has over 1,500 hundred rows, the largest is 29148 rows. The data goes back as far as 2005.
Please can someone help me find a solution?
One possible solution is to create a helper column which returns 1 if the row is visible and returns 0 if the row is invisible (or blank). This allows a bit more freedom in your formulas.
For example, if you want to create a helper column in column X, type this into cell X9 and drag down:
= SUBTOTAL(103,A9)
Now you can create a custom average formula, for example:
= SUMPRODUCT((MONTH(E9:E1833)=1)*(X9:X1833)*(J9:J1833))/
SUMPRODUCT((MONTH(E9:E1833)=1)*(X9:X1833))
Not exactly pretty but it gets the job done. (Note this is an array formula, so you must press Ctrl+Shift+Enter on your keyboard instead of just Enter after typing this formula.)
With even more helper columns you could avoid SUMPRODUCT altogether and just accomplish this by doing a single AVERAGEIFS.
For example if you type into cell Y9 and drag down:
= MONTH(E9)
Then your formula could be:
= AVERAGEIFS(J9:J1833,X9:X1833,1,Y9:Y1833,1)
There isn't a clean way to do this without at least one helper function (if you want to avoid VBA).

Filtering the output for importhtml in Google Sheets

I am building a google sheet to do calculations based on information I found on different websites and stumbled upon the IMPORTHTML function in Google Sheets.
Terrific, I want to import tables and then use some of the values out of those tables to build my sheet and make further calculations.
However, since the function retrieves both the headers and all the information in the table that makes it quite hard to work with. Instead I would like to pull only certain of the data, preferably specific cells in the table pulled.
Is this possible?
For example:
=ImportHtml("http://en.wikipedia.org/wiki/Demographics_of_India"; "table";3)
returns a huge list, what if I would like to pull only the values of B7 and D7? Is that possible? Even filtering out a single row would be useful, whatever that is more feasible. The most important part is that I can get a single row and dont have the full table.
Found the INDEX function, doing exactly what I need it to do!

Resources