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))))}
Related
I have a very big correlation matrix that is very hard to navigate.
I want to make two dropdown menus to select two items (X and Y) and need a formula in google sheets to output the corresponding correlation.
I am aware of the method of doing this by putting the row and column number, as described here but I want to put in the values in the row and column, not their number.
I would appreciate the help.
thank you
You just need to use INDEX() with two MATCH() formulas.
The first MATCH() gets the row number for the label you selected
The second MATCH() gets the column number for the second label
For example, if I have my drop-downs in B1 and B2 and the data in a Data! sheet:
=INDEX(Data!A1:ZZ, MATCH(B2,Data!A:A,false), MATCH(B1,Data!1:1,false))
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.
If I have hierarchical data in a Google Sheet as in columns A and B in the example below, how can I write a formula that will fill the corresponding cells in column C with the product of the "parent" value in A1, and the "child" values in column B. That is, The formula in C8 for example, will search upward in column A until it finds the value 5 in A6, then multiplies it by 8, the value in B8.
Obviously I'm trying to avoid having to put the "parent" value in every row in column A.
After a fiddling around and jogging my memory on ArrayFormulas I figured out how to get the result I wanted. Here's the formula I'm using:
=ArrayFormula(index($B$2:$B2,MAX(IF(ISNUMBER($B$2:$B2),ROW($B$2:$B2)))-1,1))
(Note: Row 1 contains headings)
Edit: Explanation of how I arrived at this solution:
Ordinarily, IF(ISNUMBER(cell)), and ROW(cell) would return TRUE/FALSE, or a row number respectively. When used in an array formula and a range of cells as input instead, what you get is a list of TRUE/FALSE values, and row numbers evaluated for each cell in the input range. Wrap MAX around that and it will return the position in those two lists where IF(ISNUMBER()) is TRUE and the row number returned by ROW() is the highest, effectively searching from the bottom of the range.
The absolute reference for the first element in the range to be searched (in this case $B$2) keeps the range anchored to the same starting location when dragging the formula into other cells, while the lower bound of the range (in this case $B2) to be searched grows vertically.
Finally, the INDEX takes the input range, row number returned by the above (-1 row because of the header) and column position (1, since there is only one column) in order to return the desired value.
One way you could do this would be to associate each value in column B with a category or key that can be used to lookup the value for A in a separate table. This abstracts it somewhat, so you can change the values for the A column without having to have them in every row, but there's no empty cells.
i.e.
and lookup table:
In column C
= VLOOKUP($A1, <range for category lookup table>, 2, 0) * $B1
(And then this formula can be filled down)
More on VLOOKUP in Google Sheets here
Alternatively I suppose you could use a formula to find the last non-empty row in column A, or something along those lines, but this is more of a hack than a proper way to structure your data. Tables aren't really designed to be used in a hierarchical fashion like what you've shown. But they can easily represent hierarchical data using techniques like what I've suggested.
I'm using Google Spreadsheets. I'll be using this image from a very similar question.
http://i.imgur.com/jqcNW.png [a link]Google Spreadsheet Formula to get last value in a row
Instead of giving the value, I want the Column top to show. So the H column would look something like: 2 1 3 1 4
(The product numbers from Row 1)
If it helps =index(B2:G2;1;counta(B2:G2)) was the answer given to the original question. My values would be words instead of numbers. It'd need to track the last 'Yes' in the row with the column top being dates.
I think this should be easy:
=index($B$1:$G$1;1;counta(B2:G2)) - if you write this to the H2 cell, it should search the "N"th element in the FIRST row ($B$1:$G$1) - where N represents the value of non-empty cells in that row (B2:G2).
You can then populate this H2 formula downwards.
Let me know if this helps.
Hi I am new to Excel/Google Spreadsheet.
I have a problem that I want to search the entire sheet for a given string.
For example the table looks like
A B C D
1 foo 1 bar 2
2 bar 9 abc 3
3 foo 2 bar 4
LOOKUP/MATCH/VLOOKUP can only search one row or column, I need a formula to search for the whole sheet for 'bar', and return the array of all found cells, e.g. {$C$1, $A$2, $C$3}.
What's more (the ultimate goal) is to calculated the sum of the numbers next to the found cells, in this example, 2+9+4=15.
I hope this can be achieved without VBA so that I can use the formula in Google Spreadsheet as well.
For your example, in Excel:
=SUM(IF(A1:C3="foo",B1:D3,0)) entered as an array formula, with ctrl-shift-enter
In Google:
=ARRAYFORMULA(SUM(IF(A1:C3="foo",B1:D3,0)))
The ranges can be as large as you like. The important points are that the first range covers all of the values you want to look for text in, and that the second range is the same size but shifted one cell to the right.