I've downloaded a CSV file which I've imported into Google Sheets. It appears that it has imported in a vertical manner.
I want the data to be horizontal like this for example
Is there any way I can do this easily?
Easy way:
Use Pivot table. Put Year in columns and Entity in rows. More here.
More complex:
Use the query formula with the pivot functionality. More here.
=QUERY(A2:C, "select A,avg(C) where A is not null group by A pivot B")
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))))
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)''"))
I am having the following problem: There are two Sheets in my document which contain different data about the cities (which are listed in column A in both cases). I am trying to create a combination where the data about a given city is merged from the second sheet.
I was trying to explore QUERY function, as it's suggested in a similar topic:
=QUERY({Sheet1!A2:C5;Sheet2!A2:C5},"select Col1 where Col1 <>''") However it's not clear how to replace the where Col1 <>'' with an appropriate statement.
Since Query Docs does not support Join similar to SQL, one workaround is to use ARRAYFORMULA, VLOOKUP, and indirect reference to achieve a similar result:
=ARRAYFORMULA({Sheet1!A1:C5,VLOOKUP(Sheet1!A1:A5,Sheet2!A1:B5,COLUMN(INDIRECT("R1C2:R1C"&COLUMNS(Sheet2!A1:B5),0)),0)})
From your tables on the question, the result looks like this:
References:
ARRAYFORMULA()
VLOOKUP()
INDIRECT()
COLUMN()
COLUMNS()
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)''"))