Query google sheet => how does "null" work in this formula? - google-sheets

I have 1 mastersheet in which I want to add all the data from 2 other sheets if column J (Col10) is empty.
This formula does not work:
=query({'BXL | hair salon | Export'!1:1000; 'BXL | Bike shop | export'!1:1000}, "select * where Col10 is null", 1)
In this case I only get the results from the first sheet. (BXL | hair salon)
The opposite, where I do the following (and add all the data where column j is not null) does work (but it's ofc not what I need):
=query({'BXL | hair salon | Export'!1:1000; 'BXL | Bike shop | export'!1:1000}, "select * where Col10 is not null", 1)
How is this possible? Is there something about null i do not understand?

Ok, I found the answer.
Not null also takes the cells of the completely empty rows. When I scrolled way (way) down, I could see the results.
I fixed it for now like this:
=query({'BXL | hair salon | Export'!1:1000; 'BXL | Bike shop | export'!1:1000}, "select * where (Col10 is NULL and Col2 is not null)", 1)
As every column B has data when it's a not empty row, this filters out the entirely empty rows.

Related

Count values without having to specify each

I need to count how many times ids repeats, without having to specify each id. In my case I need it for know how many customers come 3 times or more in a month. Here is an example of where Im getting the data from:
customers| id
------------------
person 1 | 2433340
person 2 | 3457548
person 3 | 3457584
person 4 | 4343218
person 4 | 4343218
person 4 | 4343218
person 3 | 3457584
And this one is the one that I need to fill:
Times that customers come
--------------------------
1 time | 2
2 times | 1
3 times | 1
I have used:
Formula in D2:
=QUERY(QUERY(B2:B,"Select Count(B) where B is not null group by B label Count(B) 'Times'"),"Select Col1, count(Col1) group by Col1 label count(Col1) 'Count'")
I would work with a helper column (D) to count visits per person. Then it is pretty easy to count the "x times".
Values in column F are numbers formatted as "0 "time""

How to transpose & split multiple columns and repeat specific cells in a column

I am looking to transpose, split, and keep the correct corresponding Category/Reference Number.
Column A: Category / Reference Number.
Column B: Email (CSV)
| A | B | | A | B |
|001|Email1,Email2,Email3| |001|Email1|
|002|Email4,Email5,Email6| |001|Email2|
| | | |001|Email3|
| | | |002|Email4|
| | | |002|Email5|
| | | |002|Email6|
Here is another post which is similar to what I am looking to accomplish. The only difference is in this post, the OP requested that the formula duplicates data X times. Here is the formula that is used:
=ARRAYFORMULA({TRANSPOSE(SPLIT(CONCATENATE(REPT(B2:B&",", A2:A^2)), ",")),
TRANSPOSE(SPLIT(CONCATENATE(REPT(C2:C&",", A2:A)), ","))})
I have tried modifying this formula by removing the "^2", "A2:A" replacing with a COUNTIF (to determine the number of emails in each row), and keep breaking the formula.
What am I doing wrong?
Here is my sheet.
try:
=ARRAYFORMULA(TRIM(QUERY(SPLIT(FLATTEN(IF(IFERROR(SPLIT('Form Responses'!C2:C, ","))="",,
'Form Responses'!B2:B&"×"&SPLIT('Form Responses'!C2:C, ","))), "×"),
"where Col2 is not null")))

Use google query as an array formula to sum values in a column based on information in another column

I have 2 tabs needing worked with. The first tab, market_pull has a function that pulls information from EVE Online's ESI and sorts the information into several columns:
duration | is_buy_order | issued | location_id | min_volume | order_id | price | range | type_id | volume_remain | volume_total
The second tab, bulk_market_data sorts the information into several columns:
Citadel ID | Item Id | Item Name | Volume Ea | Qty Available | Lowest Price | Total Volume | Jita Sell | ISK Difference | % Difference
I need help with the bulk_market_data tab. I need to use the Item Id column from bulk_market_data as a criteria to compare to market_pull the column type_id pull the MIN value from the corresponding row in the price column.
I need to do essentially the same thing except I need to use the Item Id column from bulk_market_data as a criteria to compare to market_pull the column type_id pull the total SUM value from the all the corresponding rows in the volume_remain column.
I'm using array formulas because in the bulk_market_data tab there is about 10,000 rows and when I had a formula in every row for every column the sheet slowed down drastically. Thank you for your time and HERE is a sample spreadsheet with the concept.
use in F4:
=ARRAYFORMULA(IFNA(VLOOKUP(C4:C, QUERY({market_pull!C4:C, market_pull!J4:K},
"select Col2,sum(Col3) where Col2 is not null and Col1 = FALSE group by Col2"), 2, 0)))
use in G4:
=ARRAYFORMULA(IF(C4:C="",,IFNA(VLOOKUP(C4:C, SORT(QUERY({market_pull!C4:J},
"select Col8,Col6 where Col1 = FALSE"), 1, 1, 2, 1), 2, 0), 0)))
use in H4:
=ARRAYFORMULA(IF(C4:C="",,ROUNDUP(IF(
E4:E1004*F4:F1004=0,,E4:E1004*F4:F1004), 1)))

In Google Sheets How do I get a sum of comma separated values in rows against an ID

I have a table which has a list of id's against names
Sheet 1
A | B
1 | Joe
12 | Dave
23 | Pete
I then have a table of rows which shows when a person was present at an event (through their ID)
Sheet 2
A | B
boston | 1
florida | 1,12
nyc | 12,23
In the 3rd sheet for appearances, I am then looking to achieve the following
Sheet 3
A | B (Appearances)
Joe | 2
Dave | 2
Pete | 1
I can get this to work when just one person makes an appearance with something like =COUNTIF(appearances!A:A, INDEX(name_db!$A$2:$A$1000, MATCH ($A11, name_db!$B$2:$B$1000, 0)))
But as soon as I add a comma value it all goes wrong.
I've tried looking into vLOOKUPS and things like that but can't seem to quite figure it out
Any help on where to look would be much appreciated
=ARRAYFORMULA(IFERROR(VLOOKUP(G:G, QUERY(VLOOKUP(TRANSPOSE(SPLIT(CONCATENATE(
IF(IFERROR(SPLIT(E:E, ","))<>"", "♦"&SPLIT(E:E, ","), )), "♦")), A:B, 2, 0),
"select Col1,count(Col1) group by Col1 label count(Col1)''", 0), 2, 0)))
This works for me:
=ARRAYFORMULA(IFERROR(SUM(SPLIT(D2;","))))

Auto-filling empty cells with Google Sheets' query

I have a table with data that I want to run a QUERY from.
In the output tab I need just one column from the data tab, but also I have 3 empty columns in the output tab, that are not in the data tab, that I need to be filled automatically, based on conditions, preferably with the QUERY.
I am using a simple QUERY formula to load the data that I have in the source tab to the output tab.
=QUERY('Source'!$A$1:$X, "SELECT A WHERE F IS NOT NULL", 1)
The issue is that I can not have any other formulas in the output sheet, rather than the QUERY itself, as some issues arise when exporting Google Sheet that contains formulas to .CSV.
Regardless if the above is true or not, these are the rules...
This is the output that I need to have:
+---------+------------+-------------------+-----------------+
| Country | Researched | Status | Reason |
+---------+------------+-------------------+-----------------+
| UK | TRUE | In Progress | |
+---------+------------+-------------------+-----------------+
| US | TRUE | Unable to Proceed | Not a UK member |
+---------+------------+-------------------+-----------------+
Column 1 is what the QUERY extracts from the source.
Columns 2 to 4 are the ones that I need to create with the QUERY.
The value of each cell in those columns depends on column 1, except for column 2 that needs to have the value "TRUE" for each record.
Is it possible to implement multiple conditions in the QUERY itself, that will fill the empty columns in the output tab, based on conditions?
=QUERY({QUERY(Source!$A$1:$X,
"select A, 'TRUE'
where F is not null
label 'TRUE' 'Researched'", 1),
QUERY(ARRAYFORMULA(IFERROR(VLOOKUP(
QUERY(Source!$A$2:$X,
"select A
where F is not null", 0),
{"UK", "In Progress", ""}, {2, 3}, 0),
{"Unable to Proceed", "Not a UK member"})),
"select *
label Col1 'Status', Col2 'Reason'", 0)}, , 0)

Resources