I have three columns with multiple rows: The first column (A)is numbered (1,2,3,4) the second column(B) is lettered (A,B,C,D), and the third is corresponding info (C).
I want to be able to select a boolean that toggles the sorting of the sheet between sorting in descending order by the numbers (Column A) and sorting by the letters (Column B)
Thank you!
Try:
=IF(D1,SORT(A4:C,1,false),ARRAYFORMULA(A4:C))
Result:
Using IF() to check if checkbox is true, then SORT() the Columns A,B,C by descending order based on column A.
Related
I have a spreadsheet where in TAB A I have a database with the "raw" data imported from another db, where I have some products with unique ID's and a few other columns.
What I'm trying to do is on TAB B, using an arrayformula, is count all of the unique numbers for the specific ID, I left an example on TAB B on the top rows using QUERY formula.
here is the spreadsheet link if you wanna take a look at the data: https://docs.google.com/spreadsheets/d/1-pFeQWVD_0fpBdC-GzHBlnr92bGDQn-6kqEdWfTAkPI/edit#gid=487890997
Thanks in advance for the help!!
You can use this QUERY for selecting the UNIQUE values of ID and Product number in B1:
=QUERY(QUERY('TAB A'!A:C;"SELECT A,C,COUNT(B) WHERE A is not null group by A,C");"Select Col1,Col2")
And this MAKEARRAY in D2 for the counts of unique values:
=MAKEARRAY(COUNTA(B2:B);COUNTA(D1:1);LAMBDA(r;c;COUNTA(UNIQUE(FILTER(INDEX('TAB A'!D2:F;;c);'TAB A'!A2:A=INDEX(B2:B;r))))))
Summary
Goal: count cells that contain specific strings in columns A AND B checking each pair of rows in the columns.
What I have So Far: =IF(AND(B3="GA", C3="Grocery"), COUNTIF(C3, "Grocery"),0)
What I Need: how to specify continuing this process for each pair of rows in columns A and B.
Context: counting business in different states that have been assigned specific categories. For example, how many businesses in Georgia ("GA") are categorized as "Grocery"?
Example Google Sheet
Details
I am creating a function with the goal of checking cells in columns A and B in the same row to match a specific string for each, adding +1 to the count if they both match, then checking the next row in columns A and B. How can the function be written to continue checking all of columns A AND B row by row?
Thank you!
Try something like-
=BYROW(FILTER(B3:C,C3:C<>""),LAMBDA(x,IF(AND(INDEX(x,1,1)="GA",INDEX(x,1,2)="Grocery"),COUNTIFS(C3:C,"Grocery"),"")))
Or try-
=BYROW(B3:C,LAMBDA(x,IF(AND(INDEX(x,1,1)="GA",INDEX(x,1,1)<>"",INDEX(x,1,2)="Grocery"),COUNTIFS(C3:C,"Grocery",B3:B,"GA",INDEX(ROW(C3:C)),"<="&ROW(x)),"")))
As per sample sheet provided in comment, you can try this formula.
=COUNTIFS(C3:C,E16,B3:B,"GA")
try:
=INDEX(IF((B3:B="GA")*(C3:C="Grocery"),
COUNTIFS(C3:C, "Grocery", ROW(C3:C), "<="&ROW(C3:C)), 0))
I got a table_1 that has 2 columns in (Q and R) the end with checkboxes.
I want to create and secondary table_2 that has dependency on the table_1 in such a way that it imports rows from Table_1 when I have TRUE value in column Q but removes it when I set value to TRUE in column R.
I tried using Filter, but it does not work after I alter data in table_1.
Basically, I want to make it work all the time. Not just once.
https://docs.google.com/spreadsheets/d/1I9RwXYBeibhL-mQBsSZHbB5QEBD24gbUBWldBucNmsw/edit?usp=sharing
You should use FILTER formula or QUERY formula.
Let's say you want to have a Sheet2 based on Sheet1 where you show only orders paid (P) but not delivered (Q) yet:
Source sheet according to your link:
Solution:
=FILTER(Sheet1!B2:R;Sheet1!P2:P=TRUE;Sheet1!Q2:Q=False)
First parameter: Sheet1!B2:R tells what will be displayed (all rows from 2 to the end and columns from B to R)
Second and Third parameters set conditions that are checked for each row separately.
If you want to have tick boxes in Sheet2, you should select P and Q columns and use Menu --> Insert --> Tick box.
It will change format of these columns but will not affect the content.
I'm trying to work out a function in a Google Sheets cells to look at a column then search current row and "above" the current row to find a non number value (text).
I have data that in two columns B (item code or category) & C (item description).
I need another column to contain the categories for each item - column D. I'm looking for a formula for this column, ideally an Arrayformula as the data can change, there can be multiple items per category, some might be only 1 item, some might be 100 items per category. The arrayformula in column D will get the category from column B if it is not a number.
B column - categories and item codes, C column - item descriptions, target is D column a copy of the categories from column B.
I've tried this numerous times and usually give up, do it manually but it becomes teadious quickly. Looking forward to any help that might come from this! thanks.
In D2 try
=Arrayformula(if(isnumber(B2:B), vlookup(row(B2:B), filter({row(B2:B) , B2:B}, istext(B2:B)), 2), B2:B))
and see if that works?
Try in D1
={"Category";ArrayFormula(lookup(row(B2:B),row(B2:B)/if(isnumber(B2:B),0,1),B2:B))}
I'm sorry this is titled so horribly.
I have a category column in a sheet (col H) and in another sheet I've got the unique values in those columns with unique(sheetname!H)
How do I get only the categories (col H values) whose value in, say, col F, is 'credit'?
A given category will always have a given col-F value: will always be credit or debit. And will always belong to a certain person, as well. Say the person's name is in column B. How do I display the person who "belongs" to that category?
Using queries should make this simple.
Something like this should work:
=QUERY(A:H, "select H where F='credit'",0)
More details on how the information is stored would help.
The first parameter is the range of cells to perform the query on. The second parameter is the query. The third is the number of header rows at the top of data.
More info on QUERY: https://support.google.com/docs/answer/3093343?hl=en
To display the names in column B along with the categories, you can use:
=QUERY(A:H, "select B,H where F='credit'",0)
try:
={H1; FILTER(H2:H; F2:F="credit")}
for unique:
={H1; UNIQUE(FILTER(H2:H; F2:F="credit"))}