I have a table that contains information on people who volunteered for multiple organizations over a one-month period. One person could have volunteered for the same organization on multiple dates, and multiple people could have volunteered on the same date. I'm interested in tracking, for each organization, unique volunteers (individuals who have volunteered at any point over the course of the month) and unique shifts (for the purposes of this data, a shift is one person volunteering on a unique date).
How can I pull the unique shifts metric? Here's an example of the type of data I'm dealing with:
Organization | Date | Volunteer
A | 10-01-2018 | Jane
A | 10-01-2018 | Ben
A | 10-02-2018 | Jane
B | 10-01-2018 | Emily
B | 10-02-2018 | Jack
You can see that Organization A has 2 unique volunteers and 3 shifts, while Organization B has 2 unique volunteers and 2 shifts. I'm able to get the unique volunteer count by using countuniqueifs with the organization as the criterion, but to get the number of shifts I need both the "Date" and "Volunteer" columns to be unique, while keeping the organization as the criterion.
I'm interested in tracking, for each organization, unique volunteers
=UNIQUE({A2:A, C2:C})
=QUERY(UNIQUE({A2:A, C2:C}),
"select Col1,count(Col2)
where Col1 is not null
group by Col1
label count(Col2)''", 0)
(individuals who have volunteered at any point over the course of the month)
=QUERY(UNIQUE(FILTER({A2:A, C2:C}, MONTH(B2:B)=10)),
"select Col1,count(Col2)
where Col1 is not null
group by Col1
label count(Col2)''", 0)
and unique shifts (for the purposes of this data, a shift is one person volunteering on a unique date)
=QUERY(UNIQUE(FILTER({A2:A, B2:B&C2:C}, MONTH(B2:B)=10)),
"select Col1,count(Col2)
where Col1 is not null
group by Col1
label count(Col2)''", 0)
Related
I have this table:
Name | Age
Ann | adult
Ann | adult
Andrew | adult
Mike | adult
Ann | teenager
John | teenager
John | teenager
I want this output:
Age | count Name (distinct Names)
adult | 3
teenager | 2
Unfortunately, I can't go further then this formula:
=QUERY(table; "select B, count(A) group by B"; 1)
where the 'table' is the named range with input data. And it gives me this:
Age | count Name
adult | 4
teenager | 3
I need something like:
=QUERY(table; "select B, count(unique(A)) group by A"; 1)
which obviously doesn't work.
So, how can I achieve my target output with querying?
I know, I can do that with pivot tables with countunique function, but I want to go without pivot tables.
One option could be QUERY + UNIQUE:
=QUERY(UNIQUE(A2:B),"SELECT Col2, COUNT(Col1) WHERE Col2 IS NOT NULL GROUP BY Col2")
You can also make use of this formula:
=ARRAYFORMULA(QUERY(UNIQUE({B:B, B:B & A:A, A:A}), "SELECT Col1, COUNT(Col1) WHERE Col1 IS NOT NULL GROUP BY Col1 ORDER BY COUNT(Col1) DESC LABEL COUNT(Col1)'count Name'", 1))
After
Explanation
The formula makes use of the following functions:
ARRAYFORMULA
UNIQUE
QUERY
In order to find the unique values, the UNIQUE is used for the range needed for the query (A:B) such that the sorting and counting is done on this range. The LABEL is used as well in order to set the header name for the resulted column.
Reference
ARRAYFORMULA;
UNIQUE;
QUERY.
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""
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)))
I have a Google Form that outputs data like this:
Buyers sheet's row example (for each buyer who filled the form):
Timestamp | User 1 | Product 1 | Price 1 | Product 2 | Price 2 | Product 3 | Price 3 ...
Timestamp | User 2 | Product 1 | Price 1 | Product 2 | Price 2 | Product 3 | Price 3 ...
And on another sheet called Bids:
Product 1 | Base Price
Product 2 | Base Price
Product 3 | Base Price
The result I'd like to achieve is getting all the bids for the different products and display next to each product the highest bid with the corresponding username. I've tried with lookupv and query but did not succeed, I'm not exactly an expert in Google Sheets (that's an euphemism).
Any ideas?
Here is an copy of the actual sheet:
https://docs.google.com/spreadsheets/d/1bW_MlogHpXQk-_DZupE22No7KwUyZesqggsEdQaXPgw/edit?usp=sharing
With an example on the Bids sheet for computer of what I'm trying to get.
Buyers is a sheet populated automatically from a Google form.
use:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, SORT(SPLIT(QUERY(FLATTEN(IF(
FILTER(Buyers!C2:1000, MOD(COLUMN(Buyers!C1:1)-1, 2)=0)<>"",
FILTER(Buyers!C2:1000, MOD(COLUMN(Buyers!C1:1)-1, 2)=0)&"×"&
FILTER(Buyers!C2:1000, MOD(COLUMN(Buyers!C1:1), 2)=0)&"×"&Buyers!B2:B1000, )),
"where Col1 is not null"), "×"), 2, 0), {2, 3}, 0)))
I'm trying to merge two datasets in order to insert default rows for missing data. The use case is that I have a list of dates and attendance numbers for training sessions on those dates, but if I have no records at all for a training session then it's missing from the list.
In my sheet at the moment I have a two column set of dates and attendance numbers, and in another sheet I have worked out all the Wednesdays and Fridays (training days) between the start and end dates of all the sessions we have data for.
Is there a way to merge the two datasets together so that the zero attendance for each session is the base set and then I merge in the rows for which I have data? I've tried using some of the query command but if I specify two datasets using {Sheet1!A1:A,Sheet2!B1:B} I get array errors.
The attendance information is currently gathered with a query like this:
=QUERY({Records!A2:B}, "SELECT Col1, COUNT(Col2) WHERE (Col1 IS NOT NULL) GROUP BY Col1 ORDER BY Col1 ASC LABEL Col1 'Session Date', COUNT(Col2) 'Skaters'") where the Records sheets is just date and names.
If I update it to read from two datasets (=QUERY({Records!A2:B, Scratch!B2:B}, "SELECT Col1, COUNT(Col2) WHERE (Col1 IS NOT NULL) GROUP BY Col1 ORDER BY Col1 ASC LABEL Col1 'Session Date', COUNT(Col2) 'Skaters'")then I get a REF error of Function ARRAY_ROW parameter 2 has mismatched row size. Expected: 982. Actual: 999. Seems fair, as it's created misaligned dataset, rather than merging based on the date column.
I'm probably treating the spreadsheet a bit too much like a database, and while I would be more comfortable dropping into the script editor to resolve this I'm trying to learn a few spreadsheet techniques.
Data
Records looks like this:
| 2018-05-04 | Bob |
| 2018-05-04 | Fred |
| 2018-05-12 | Bob |
So no-one took attendance on the 9th, and so the stats are skewed as Bob gets a misleading 100% attendance record.
I do not understand the details of what you are trying to do but since it seems to involve combining one list of just dates and at least two lists of dates and names offer the following example:
The formula is:
=ArrayFormula(query({Sheet1!B1:C20;Sheet2!E1:F20;Sheet3!I1:J20},"select * where Col2 is not NULL order by Col1 "))