Can I add a floating column to a Sheets query? - google-sheets

I have a Sheet like this [minimal] example. The "Data" tab is a running list of points different groups have scored. This is constantly updating. The "Results" tabs gets a list of all the unique group names from the Data tab and add them as a row in Column A. So, if an entry for "Group5" is entered on the Data tab, a row with that name will appear on the Results tab. Similar for the columns on the results tab. Each unique action on the Data tab becomes a column on the results tab.
I would like to add a "Total" column to the last column on the Results tab. The problem is, if a new "action" category appeared on the data tab, it would take up the last column and the Total column would need to shift over one. Is there a way to get the "Total" column to float so that it is always on the end without conflicting with the query formula?

In B1 cell put below formula-
={TRANSPOSE(UNIQUE(QUERY(Data!C2:C, "SELECT C where C is not null",0))),"Total"}
In B2 cell put below formula then drag down and right as needed.
=IF(OR($A2="",B$1=""),"",IF(B$1="Total",SUMIFS(Data!$D$2:$D,Data!$B$2:$B,$A2),
SUMIFS(Data!$D$2:$D,Data!$C$2:$C,B$1,Data!$B$2:$B,$A2)))

Related

Vlookup code for a query in Google Sheets

I have 2 different tabs in a sheet and I want to fetch minimum "Age" along with "Father Name" of the given two duplicate names of children.
You can check left tab as what data look like and right tab for what result I want, In right tab No name will occur twice and I have to fetch only the age with minimum number with VLookup or any other function.
I tried Vlookup, with min function but I was not getting desired result.
you can try:
=INDEX(IFNA(VLOOKUP(A3:A,SORT('TAB1'!A:D,4,1),{4,3},)))
Change TAB1 in the formula to your respective tab name
Try the following formula-
=LAMBDA(nm,ag,{nm,ag,MAP(nm,ag,LAMBDA(p,q,FILTER(C:C,A:A=p,D:D=q)))})(UNIQUE(A2:A8),BYROW(UNIQUE(A2:A8),LAMBDA(x,MINIFS(D2:D,A2:A,x))))

=FILTER arrayformula with

Test sheet
I have an Options sheet that categorizes transactions based on their type. In the Transactions sheet, I add transactions with their corresponding category, and I am trying to create a formula where the corresponding category type is automatically added in the column next to it.
I have been able to create a partially working formula:
=ARRAYFORMULA(FILTER(Options!C:C,Options!B:B=D31))
I want to expand it across all the cells in column E using an ARRAYFORMULA, but I can't seem to figure out how to have the Options!B:B=D with the corresponding cell. Making it =D31 I've been able to figure out, but having one formula at the bottom (at Ref 1) and then the right category type for each corresponding cell, I have not.
use in E2:
=ARRAYFORMULA(IFNA(VLOOKUP(D2:D, Options!B:C, 2, 0)))

How to import data from other sheet and list them?

I have Sheet1 and Sheet2in the same document. In Sheet1 from Row 2 (A2~ZX2) there are names. At Row 5 (A5~ZX5) there are checkboxes with custom values set to either 1 for checked, 0 for unchecked.
At Sheet2 I want to load Sheet1's A2~ZX2 values where their checkbox is unchecked.
I figured out that =Sheet1!$A1 can load from another sheet, but I don't know how to make as a list that automatically filters checkbox value.
I'm not sure that you need Sheet 2. Use the funnel looking icon to set up a filter on Sheet 1.
Please try:
=transpose(query(transpose(Sheet1!A2:ZX5),"select Col1 where Col4 <> TRUE"))
Leave off the outer TRANSPOSE for a list in a column rather than by row as in your source.

find corresponding cell depending on other cell

I'd like to get the value of a cell depending on the value entered in another cell. I have different sheets in my workbook :
Sheet 1: One with a list of people and adresses
Sheet 2: One with a list of orders from these people
In Sheet 2, when I choose a client's name from the dropdown list (created via data-validation list with sheet 1), I'd like his address to display automatically in another cell (same row, different column).
Is there a way to do that ?
Thanks in advance !
A simple vlookup will do this. Assuming you have the dropdown in A2 of Sheet2, put this in Sheet2 in the column you want the address in. If you have a dropdown in each row, drag the formula down:
=iferror(vlookup(A2,Sheet1!A2:B4,2,false))

Delete row based on column in Google Sheets

I have Google Sheets where I need to delete all the rows IF the Column contains the number 0. Any quick way to do this? I have over 20000 rows to go through and I don't want to do this manually.
An easy and old style method is sort on that column so that all the rows having that column value '0' are together. Then select all those rows using Ctrl + Page Down and then press delete. NO need to explore any fancy options for such simple things.
Another quicker option is to use filter. Select the column and then click Filter under the Data menu. Then from the drop down, select '0' for the filter by values. This will hide all the rows that don't contain 0 in that column. Then simply select all those rows and delete them.

Resources