I have a google sheet that is looking at another sheet in the same workbook with cell values that are a string list populated by a pandas dataframe generated from a REST API json response.
I need to visualize this data so I'm thinking need to parse the comma separated values from the list, then append/stack them on top of one another so that I can reference the column in a pie chart in Google Data Studio.
I parsed the values using the SPLIT function (column C) but now stuck on how to append them into one column stacked on top of each other.
There could also be a totally different approach here that I'm not thinking of. Any tips on how to build this out so it's in an array method (updates as the reference sheet is updated daily) that would be awesome - thanks all.
Alternatively if there's a way to create a field at the Google Data Studio report level that would work well too.
use:
=ARRAYFORMULA(QUERY(FLATTEN(IFERROR(SPLIT(REGEXREPLACE(Sheet2!A2:A,
"\[""|""\]|"",""|\['|'\]|','", "♦"), "♦"))),
"select Col1,count(Col1)
where Col1 is not null
group by Col1
label count(Col1)''"))
Related
I am trying to create a specific table based on data downloaded from a certain tool.
The best way to describe my problem is to check the table with example data and result that I would like to get (link to the Gsheet and screenshot attached below).
Part of the data like "type of activity" sometimes can be done a few times, but in the "result" table they need to be summed up.
https://docs.google.com/spreadsheets/d/1u4dMoUWg6r3eUVZ9qEfkWiMS8iLgDr_TwnjS1GEXKTU/edit?usp=sharing
here is a screenshot
google sheet
and a link to It in case if it wont work https://pics.one.ly/wbuXpg40
Use QUERY() function with pivot clause. Try-
=QUERY(A11:D25,"select B, sum(D) group by B pivot C")
Make a pivot table
check data : you have typed clinet instead of client
I am making a spreadsheet to compare various lists in various different ways. One of those ways is to take a bunch of separate lists (each in different columns) and combine them into one large column (without losing anything). This allows me to keep things separate while still having the option to VLOOKUP and FILTER and stuff. Maybe this isn't the way to go about it, but it's the way I've gone with so far.
The solution I came up with for now is to QUERY it all as an array (I think that's the right term) and then just select everything that isn't "".
It looks like this though:
=QUERY({Decklists!B8:B;Decklists!C8:C;Decklists!D8:D;Decklists!E8:E;Decklists!F8:F;Decklists!G8:G;Decklists!H8:H;Decklists!I8:I;Decklists!J8:J;Decklists!K8:K;Decklists!L8:L;Decklists!M8:M;Decklists!N8:N;Decklists!O8:O;Decklists!P8:P;Decklists!Q8:Q;Decklists!R8:R;Decklists!S8:S;Decklists!T8:T;Decklists!U8:U;Decklists!V8:V;Decklists!W8:W;Decklists!X8:X;Decklists!Y8:Y;Decklists!Z8:Z;Decklists!AA8:AA;Decklists!AB8:AB;Decklists!AC8:AC;Decklists!AD8:AD}, "select Col1 where Col1 <>''", 0)
Which is really ugly. It works and does what I want, but I'd much prefer it to be clean and work if I add more columns in the future, without having to go and add the additional "call".
If you'd like to look at the whole sheet, it's here: https://docs.google.com/spreadsheets/d/17Nwek5ZCgu7Jvk922hl_gv9UJAeORjeH9brXqu3zL_Y/edit#gid=940775206
On the "Best Buys" sheet cell C2 Paste this simple formula.
=QUERY(FLATTEN(Decklists!B8:AF), "select Col1 where Col1 <>''")
Explanation
1 - FLATTEN the range needed in this case the Decklists range Decklists!B8:AF.
2 - QUERY the resulted column from the FLATTEN function with the query "select Col1 where Col1 <>''", to get only non empty cells
Try
=query( flatten(offset(Decklists!A:A,0,1,,columns(Decklists!1:1)-1)) ,"where Col1 is not null",0)
So we have 3 things to do, first one is transpose so the columns are below the other, then flatten so that it is ordered as necessary and finally a filter to remove extra blank columns we selected This will work wonders considering the columns are different lengths, are already next to each other as in a table. If columns are at multiple places use {A:A;D:D} to select columns and remove flatten and transpose.
=filter(flatten(transpose(A1:D10)), len(flatten(transpose(A1:D10))))
In Google Sheets, I'm trying to use AVERAGEIF to calculate an average of only some of the columns in another table.
The columns to be included in the average are marked by some text in a specific cell (e.g. the first or last row of that column).
Some columns are to be included in several averages, so the text in the top\bottom row would include several words (effectively meaning I'll need some sort of substring check such as FIND).
I've tried using AVERAGEIF() in conjuction with FIND() but couldn't get this to work.
Any ideas?
Here is an example of how the data sheet looks like, and how I would expect it to work
You can use following formula:
=ARRAYFORMULA(AVERAGE(IF(ISNUMBER(SEARCH(D2,A2:A9)),B2:B9,"")))
Edit:
For table mentioned in comment you must change ranges:
=ARRAYFORMULA(AVERAGE(IF(ISNUMBER(SEARCH(E2,$A$1:$C$1)),$A$2:$C$4,"")))
You can use a query
=AVERAGE(QUERY(TRANSPOSE($A$1:$D),"where Col1 contains '"&D1&"'"))
Functions used:
AVERAGE
QUERY
TRANSPOSE
Brief: I am using a formula to retrieve the information relative to the most frequently used words in a list. I am trying to make it work together with a filter in order to narrow down the results.
Parallel to this, I am filtering the results of a table based on one category (i.e. country) using filters. However, when I narrow down the results using the filter, I encounter two problems:
The filter only hides the rows that do not contain the country of choice, so the results I get are exactly the same. How can the results of this formula be narrowed down based on the visible cells?
I only manage to see all the results when I place the formula below the data, as shown on the screenshot below. Is there a way to force-show the results to the side of the filtered list?
Here's the screenshot:
Here's the spreadsheet I have created to work on a solution:
Link to Spreadsheet
un-filter your B:C range
paste in D2 and drag down this formula: =SUBTOTAL(103, B2)
hide column D
use this formula:
=ARRAYFORMULA(QUERY(TRANSPOSE(SPLIT(QUERY(FILTER(B3:B21, D3:D21=1)&",",,99^99), ",")),
"select Col1,count(Col1)
group by Col1
order by count(Col1) desc
limit 5
label count(Col1)''"))
I'm using a pivot table in a Google Spreadsheet that counts the occurrences of different types of event-types on given dates. The events are listed on one sheet, with a column for "Date" and column for "Type." Based on this a Pivot Table is produced.
The trouble is that for dates when an event-type is non-existent, COUNTA returns empty. I'd rather it return 0.
The reason is for charting and statistical purposes when you create a chart from this data, it interpolates between values, ignoring empty cells. I'd prefer that it display zero on the chart on the days when these event types don't exist...
Is this possible?
UPD: sorry, I've misunderstood what you need.
What if, on another worksheet, you write the following?
=arrayformula(IF('PivotSheetName'!A1:Z100="";0;'PivotSheetName'!A1:Z100))
(This formula makes a copy of your Pivot table on the new worksheet,
replacing empty cells with 0; moreover, the control elements of the
pivot table are copied to the new worksheet as well)