Count Unique values on an array based on multile criteria google sheets - google-sheets

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

Related

How can I combine multiple columns into one column in Google Sheets?

(Note: Please simply look at the Google sheet for the quickest understanding of what I'm describing in the below bulletpoints)
My data has rows which each represent an order
Each order (row) can consist of multiple products
For each product in an order (row) there is another set of columns in the same row
I need this data to convert into only one set of columns per row (i.e. one product per row)
The products (new rows) need to remain next to eachother so the columns can't just be added to the bottom of the array (which is more simple)
Can you please take a look at the example below and help me achieve this?
Example Sheet
Screenshot of linked sheet
Try this in another sheet
=SORT({query({Reference!$A5:$A,Reference!B5:F},"select * where Col2 is not null ");query({Reference!$A5:$A,Reference!G5:K},"select * where Col2 is not null ");query({Reference!$A5:$A,Reference!L5:P},"select * where Col2 is not null ")})

Filter on reduced values from a column?

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"))}

Delimit and join in Google Sheets

I have a range of data in Google Sheets, column A is a list of unique identifiers (eg "ABCD1"), column B is a delimited list of attributes of each (A,B,C...) . I want to produce a list of unique identifiers and every single attribute across 2 columns (for example, ABCD1 A). Please help!
raw data
outcome
try:
=ARRAYFORMULA(SPLIT(A1&"♦"&TRANSPOSE(SPLIT(B1; ",")); "♦"))

How do I create a multiple sheets that use a google sheet named TOTAL as the data source?

How do I create multiple sheets that use a Google sheet named TOTAL as the data source? Each sheet must contain the same three columns from TOTAL and other specific data, for instance, FLUX will have six columns, three from TOTAL and three custom columns added manually.
I used a query function to import the data from TOTAL to FLUX so that updating data in TOTAL will update it also in FLUX
The data in TOTAL are not fixed. It will change adding rows, which might change the order of the list. For instance, adding the row 13 in TOTAL will shift down the data in column A:C in FLUX, but not columns D:F
Is that a way to keep the reference out of the QUERY part?
Here an example: Click me
you would need to create ID system and then you would be able to match your query with rest of the static columns. in sheet SALES remove that query and put IDs in A column. then your query will be:
=QUERY(TOTAL!A1:D, "SELECT A, B, C, D WHERE C is not null", 1)
where column A contains IDs and then you create new sheet SHEET3 and paste this query in A1
and this formula in E1:
=ARRAYFORMULA(IFERROR(VLOOKUP(A1:A, SALES!A1:G, {4,5,6}, 0), ))
I have the same problem and I can't understand few steps from the answer.
Firstly, the A columns of both sheets (TOTAL and SALES) must have IDs?
Secondly, I can't really understand how the Sheets SALES should look like. Should it be like, Col A = IDs, ColB to C query from TOTAL and Col E to G static data?
In this case is it still correct creating a query in Sheet3 reading data from TOTAL?
Thank

How to retrieve a cell value and write it in another sheet checking two different columns

I have two sheets, Progress and App1stSession, in the same spreadsheet.
Progress sheet has these columns
Date Campaign Sessions 1stSessions
App1stSession sheet these columns
Date Campaign 1stSessions
I need to retrieve 1stSessions values from App1stSession. The match can be done on Date and Campaign values.
I've written this formula
INDEX(App1stSession!$A$1:C,
AND(MATCH($B1,App1stSession!$B$1:B,0),MATCH($A1,App1stSession!$A$1:A,0))),3)
Of course it doesn't work because AND retrieves 0 or 1.
So I've tried this solution
INDEX(App1stSession!$A$1:C,IF(AND(MATCH($B1,App1stSession!$B$1:C,0),MATCH($A1
,App1stSession!$A$1:A,0)),MATCH($C1,App1stSession!$C$1:C,0)),3)
I suppose that the second MATCH could retrieve the right row: neither this solution works.
Finally I've tried
=QUERY(App1stSession!$A$1:A,"SELECT """&App1stSession!$C1:C&""" WHERE
("""&App1stSession!$A$1:A&"""="""&$A1&""")AND("""&App1stSession!$B$1:B&"""="""&$C1&""")")
Again it doesn't work but I suppose because of a matter of syntax.
Any suggestion ?
Thanks
The way I would do it, is insert one unique id column/search key in column A, before the rest of your data, that is dynamically created by the date & campaign values in your App1stSession sheet:
=B1&C1
then use this type of formula to smush the same two values together dynamically on your search sheet in a vlookup fashion on your progress sheet:
=VLOOKUP(A1&B1,App1stSession!A:D,4,false)

Resources