dynamic range of columns as dimensions - google-sheets

I have a spreadsheet that looks something like this:
Harvest stats
2020-01. 2020-02. 2020-03. 2020-04.
Apples 2 3 3 4
Oranges 3 1 2 6
I would like to draw a timeline plot in datastudio with the dates in the X axis and #of fruits in the Y-axis? Is there any way to specify a range of columns as dimensions as opposed to manually adding them to the dimensions?

Your source is Google Sheets? Yes, then add another sheet and paste the values from the first one transposed.
Data Studio itself cannot pivot / unpivot data.

Related

auto ranking of rows when new data is added to sheet

I have a Google sheet (sheet A) that gets fed from another sheet (sheet B). I am trying to auto-rank the rows when new data gets added to sheet B. 
In the provided example screenshot (Example below), I use a formula for the "Points" column (M). All it does is if Column L has a value of 1 then assign 7 points, if the value is 2, then assign 5 points, and if the value is 3 then assign 3 points. All others get 1 point. So every new row is added - the points are automatically assigned.
={"Points";arrayformula(IF(L2:L="",,IF(L2:L=1,7,IF(L2:L=2,5,IF(L2:L=3,3,1)))))}
The Rank column (L) uses the formula =RANK(K2, K:K).
I want a similar formula similar to points formula that ranks each of the new rows based on the Points.
I tried this formula but it does not work -
={"Rankings";arrayformula(IF(K2:K="",,IF(K2:K>1,RANK(K2, K:K))))}
Any help is appreciated.
Example Screenshot
you can try this in Column L
={"Rank";BYROW(K2:K,LAMBDA(ax,IF(ax="",,RANK(ax,K2:K))))}

How to make scatter plot in google sheets using 2 columns as X and Y values and the 3rd columns to get color of that point?

I have 3 columns in a google spreadsheet
Runs Balls Result
24 24 W
50 20 W
10 5 L
12 10 L
5 2 L
Now I want a scatter plot to be made, such that Runs and Balls are the X and Y axes, and the color of the point is determined by the values in the column Result.
How do I achieve this?
You could separate your second column (y-value, "Balls") into two separate columns, depending on if the Result is W or L. In other words, make a chart based on three columns instead of two. This way, two different colors will be assigned automatically when the chart is generated. (Later, you can change these colors by double-clicking on the chart to get to Chart Editor -> Customize -> Series -> Format -> Color).
There seem to be no good solutions here. Answer from Monaco works but is inconvenient in cases. I settled for adding the third column as a label for the second one.

how can i make google sheet itrate over columns

I have a sheet like this how can make a cell in front of x under the sum column get the sum of the x count column and y get the sum y count column
of course, I use sum function on both but the issue I face is how to make the z ,x1,y1,z1 the same I try to fill it down but as you see in the picture it is wrong
how can I do it for 100 row ?
This formula seems to give the result you want:
={"Header","Sum";
ARRAY_CONSTRAIN(TRANSPOSE(D1:1),COUNTA(D1:1),1),
ARRAYFORMULA(MMULT(TRANSPOSE(N(D2:AJ10)),{SEQUENCE(ROWS(D2:AJ10),1,1,0)}))}
It places the two column labels in the first row, then transposes all of the header values into a vertical column in A2:A, but prevents any blank rows by using ARRAY_CONSTRAIN, and a check for the number of header values to transpose.
The main result is the Sums, calculated using MMULT. You need to enter the range of the cells you are going to sum over - I've used D2:AJ10, entered twice in the formula. MMULT can slow down performance the more cells it has to review, but this seemed fine for 33 columns by 9 rows. Test it out in your actual sheet, and report back if any issues.
REFERENCES:
ARRAY_CONSTRAIN To limit size of an array result, by # rows and # columns
MMULT The matrix product of two matrices. Can be used for summing, if one matrix is one dimensional (eg. a row or a column) with values of just 1.

Count number of times values increase in range - Google Sheets

how are you? I'm just not sure what to do here, but I surely can use your help!
I have a series of values in a row range, such as in the following:
1000 2000 1500 2100 3200
I need to figure out a google sheets formula to put in the 6th cell of this row that counts the number of times the value of any cell is greater than the one to the left of it. In this example, my result should be 3.
Is there any way that this can be done? In Excel or Google Sheets, either is great to learn.
Thank you
You can also try the following formula
=COUNTIF(QUERY({{"";TRANSPOSE(B2:F2)},{TRANSPOSE(B2:F2);""}},
"select Col1-Col2 offset 1 label Col1-Col2 ''",0), "<0")
Assuming you have data in A2:E, place the following in F2:
=ArrayFormula(IF(A2:A="",,MMULT(IF(B2:E>A2:D,1,0),SEQUENCE(4,1,1,0))))
Since there are only four columns that might be greater than others (B:E), you can structure it this way. MMULT is hard to explain, but it essentially multiplies everything in each row of one matrix (range) by everything in another range and then adds them. SEQUENCE just forms a column of four 1's by which to multiply then add together everything in each row of the first range. Since anything times 1 is the original number, this just serves to to row-by-row addition.
This formula will process as many rows as have data in A2:E.
try in 7th column on row 2:
=ARRAYFORMULA(MMULT(IF(A2:E4<B2:F4, 1, 0), {1;1;1;1;1}^0))

Google Sheet Sum Row: Count if above or below criteria

I am trying to create a summary row in a google sheet that tallies up how many cells met their criteria. These criterion are set in 2 columns to the left; Column C is the "Goal" column, which has the goal number. Column D is the "MinMax" column, which determines if that goal number is the min or max.
For example, if the Goal is 5 and the MinMax is Max, then the goal is 5 or less (5 being the maximum number allowed).
I already have successfully created conditional formatting for this sheet, which looks like the following:
=IF($D4="Min",E4>=$C4,E4<=$C4) | Turn cell green
I am struggling to find a way to use a similar calculation for the Summary row. I feel like I might need an array formula, but I'm not sure how to set it up.
If you want to count the values try:
=if(D2="Max",countif(E2:E,">="&C2),countif(E2:E,"<="&C2))
If you want to sum them useL
=if(D2="Max",sumif(E2:E,">="&C2),SUMIF(E2:E,"<="&C2))
I actually figured out a formula!!
=countif(ARRAYFORMULA(if($D$4:$D$19="Min",E$4:E$19>=$C$4:$C$‌​19,$C$4:$C$19>=E$4:E‌​$19)),true)-countif(‌​E4:E19,"N/A")
I had to go back into the data and change the blank cells to "N/A" to make it work, but it works!!

Resources