I'm having problems with something that is likey very simple to correct. I have a form that submits data to a Google Spreadsheet, simply a date, name and score. On a separate sheet I am going to have a leaderboard which shows all submissions ranked by highest score (for simplicity in the example in the link below, I just have the leaderboard showing up on the right of the same sheet). I have it sorting the data fine, but I'm struggling with getting the 'rank' value to display. As shown for the first 3 rows (G2, G3, G4) I know what the formula is to display the 'rank' value...but what I'm struggling with is how to get that value to show without having to have that formula in each cell. Since the data will be coming from a form, there will obviously be new rows added regularly which means the leaderboard will automatically get adjusted and I want all of the rows to display the rank #. From what I have read, ArrayFormula should allow this to work, but even with looking at examples I can't figure out how to get it to work with my formula.
I know I could just highlight the entire 'G' column and paste in the formula, and hope it adds it to enough rows...but then it displays 'N/A' for all of the rows which don't currenlty have any data.
Hoping its just a simple solution that I'm being dumb and missing...any help would be greatly appreciated. The link to an example is below. To summarize, for all rows that have content in column H and I, the G cell for that row should show the rank value automatically.
https://docs.google.com/spreadsheets/d/1pCIJQi5g2scOtB6o2PgVVb-0azzhupEOPjiL0RMM57A/edit?usp=sharing
Thank you!
=ARRAYFORMULA(RANK(INDIRECT("I2:I"&COUNTA(H:H)),$I$2:I,0))
This will automatically rank and sort, for all values, including additional ones that are added. You only need to enter it into G2, and it will dynamically fill in the rest for you.
You can use
IFERROR(RANK(...),"")
and drag it to all rows - this will leave blank cells instead of #N/As. I'm sure there are other ways but that seems like the easiest one to me.
Related
Collections Sheet
Expenses Sheet
Hi, I would like to get the daily sum/difference of the expenses from the expenses sheet then output to collections sheet using dates as reference/identifier.
I tried this code =MINUS(C8,INDEX(Expenses!20:31,12,2)) but I want it to auto compute when I drag the box. sorry for bad english. thank you
Desired output:
Desired Output
Output at (Net) Cash On Hand Row / Reference Date Column, the output should be August 1 Collection - August 1 Expenses.
The main issue is with the structure of your expense sheet, since you need to use only every second column. For this you can use various methods, something like
=split(substitute(join(";",Expenses!A2:DJ2),"Total:;",""),";")
The join function takes the whole row and joins it into one string, the substitute function removes the Total: from it, along with the trailing ; and the split function separates it again to separate values. This will be an array, automatically spread out to 31(-ish) columns width if entered into a cell like C10 on your Collections sheet.
Then you have two options, simply do =C8-C10 in C9, which you can drag with no problem. You can also hide the row 10 by making the text color white, or even integrate it in that sheet.
My recommendation however is not to do any of that, instead enter the formula
=arrayformula(C8:AG8 - split(substitute(join(";",Expenses!A2:DJ2),"Total:;",""),";")
into C9 on the Collections sheet and it's taken care of, without the need to drag it out. You might need to tweak it, not sure if the AG8 and DJ2 are the correct columns to end them on (should be the last column if every column or every 2 columns is a day). The arrayformula makes sure that the subtractions are done automatically for each pair of values, and expanded automatically into the row. Make sure that there are no values or formulas in D9:AG9, so it can fill up the values automatically and you don't get a #REF error.
I want to tweak an Array Formula that I'm trying to use to transpose a set of responses from a Google Form into a single 'list' in a cell in the linked Google Sheet.
Here is a simplified mock-up of the Google Sheet: https://docs.google.com/spreadsheets/d/1BKgjGK2RbXC5FkCgBOU53dLEb3fDeQADujenrqRgnT0/edit?usp=sharing
As you can see, I have a working Array Formula 'hidden' in the header for Column A, which takes the content from columns B:K in each row and transposes them with line breaks to make a nice neat list in the first cell at the start of each row (A2, A3, A4, etc.) Here is the Array Formula for ease of reference:
=ARRAYFORMULA({"Points to Develop";
transpose(query(transpose ($B$2:$B&CHAR(10)&$C$2:$C&CHAR(10)&$D$2:$D&CHAR(10)&$E$2:$E&CHAR(10)&$F$2:$F&CHAR(10)&$G$2:$G&CHAR(10)&$H$2:$H&CHAR(10)&$I$2:$I&CHAR(10)&$J$2:$J&CHAR(10)&$K$2:$K)
))})
The problem I'm having is that the formula stops working as soon as a new Google Form is submitted, as the new row of responses arrives at the top and 'pushes the formula down'/throws everything out of alignment, when all I want is for it to stay in place and run automatically every time a Form is submitted. As you can probably gauge by my limited technical terminology, I'm very much a novice at this!
How can I fix this formula, or is there a simpler or better alternative that will achieve the same results?
As often happens in life, the nature of the problem turned out to be the source of the solution. Here’s a condensed version of my thoughts as I slowly found my way to an answer (you can almost hear the hamster wheels turning in my head!):
The problem with formulas in a Google Sheet linked to a Google Form is that each new entry/submission from the form always arrives in Row 2 …
In fact, the only thing that stays ‘in place’ in the Google Sheet is the Header Row/Row 1 …
So, rather than using a formula that refers to a ‘Row 2’ that will become ‘Row 3/4/5/etc.’ as new Google Forms are submitted, I should use a formula that always refers to Row 1, that is, by using OFFSET
The obvious (if inelegant) formula that resulted from this is [I've also placed this in the final column in the Google Sheet that I linked to in my original question]:
= ARRAYFORMULA({"Points to Develop [Working OFFSET Formula]"; transpose(query(transpose(OFFSET(A1:A,1,1)&CHAR(10)&OFFSET(A1:A,1,2)&CHAR(10)&OFFSET(A1:A,1,3)&CHAR(10)&OFFSET(A1:A,1,4)&CHAR(10)&OFFSET(A1:A,1,5)&CHAR(10)&OFFSET(A1:A,1,6)&CHAR(10)&OFFSET(A1:A,1,7)&CHAR(10)&OFFSET(A1:A,1,8)&CHAR(10)&OFFSET(A1:A,1,9)&CHAR(10)&OFFSET(A1:A,1,10)))) })
I am sure that there are neater ways of getting to the same result, but this is one that works for me … and is within my levels of comprehension, so I can fine-tune and fix it as needed.
I am trying to get rid of the blank cells of the column in my sheet. I get some data from my colleagues via Google Form, and I have made some subcategory questions for them. So they get to select one of the five given choices. When I export the data to the sheet, it appears somewhat like below (linked):
https://docs.google.com/spreadsheets/d/1DBrFFNst0nhZAtxHejsrbNGkMxvcbOuie47era0Hl8c/edit?usp=sharing
Because the users can select one choice, out of five given choices four other cells must be left empty. Here's where I'm struggling with:
I have used filter function to get rid of the blank cells, but then it is restricted to only set the range either single row or column. So I end up with what you would see in my sample worksheet.
I've tried arrayformula and query as well, but I couldn't figure out a way out of this.
Any help would be appreciated.
=ARRAYFORMULA({B1:G7, {"subcategory"; TRIM(TRANSPOSE(QUERY(TRANSPOSE(H2:L7),,999^99)))}})
SOLVED EDIT
Thank you for the help. Solution here.
ORIGINAL POST
I have made a google sheet to describe the issue I am facing linked here (https://docs.google.com/spreadsheets/d/1yK6ZAX8BFnEqiuQO9HIxuY0l62ewDDccj-8EN1r2i2w/edit?usp=sharing).
I will also describe in words, below, the problem I am facing, along with the solutions I have tried.
The data of column A are random single-digit (0-9). I would like column B to show the most recent even number from column A, but only up to a specific row. That specific row is the row corresponding to the row of the cell in column B. In other words, in cell B7, I want to find the most recently entered even number of column A, specifically only on the range A2:A7 (A1 contains a column header).
This is actually a pretty simple formula, and I can get the desired outputs by simply checking if the value in a cell in column A is even and then returning the value of that cell if it is, or the output of the cell above if it isn't. So the formula would look something like: =IF(ISEVEN(A7),A7,B6)
However, my problem is that the length of the data in column A will be growing as more data are entered, and my current solution of using the fill handle to copy the formula to new cells is inelegant and time-consuming. So my desired solution is to use an array formula entered into the first cell of column B (B2), capable of returning the same value as the other formula. The formula I tried to enter to perform this was the following: =ARRAYFORMULA(IF(ISEVEN(A2:A),A2:A,INDIRECT(ADDRESS(ROW(A2:A)-1,2))))
However, as some of my previous work with arrays has taught me, not all formulas iterate as expected down the array. The formula seems to be able to return the correct output on lines which are already even, but it is unable to return the expected most-recently entered even number for all the other lines. It appears that the formula is not able to appropriately interpret the value_if_false argument of the IF formula.
I'm a little new to scripting, so I'm still trying to learn, but I also tried to dabble around with custom functions to no avail. I'm still wet behind the ears when it comes to coding, which is why I've been so lenient on the built-in formulas of Google Sheets, but I fear I may have reached the limit of what Sheets formulas can do.
I am open to trying new approaches, but my only real constraint is that I would really like for this to be a one-touch (or even better no-touch) solution, hope that's not too far beyond the scope of this issue. Any assistance would be much appreciated.
EDIT
After rubber-ducking the problem here, I went back and tried to use the OFFSET formula, hoping I could get it to play nicely with the array formula. Alas, I was unable, but I thought I should at least post my progress here for reference.
Attempt with offset
Still working at it!
Doing a vlookup on the row number seems to work for me
=ArrayFormula(if(A2:A="","",vlookup(row(A2:A),{if(iseven(A2:A),row(A2:A)),A2:A},2)))
Note: if there are no even numbers in range for some rows, it will produce #N/A for those rows.
I feel like I'm asking something that is not possible with formulas in GSheets, but I've been amazed by the things this forum has been able to answer so I'm giving it a shot. :)
I get a report each morning that show an occupancy percentage for X days out. It can be exported as a csv file and the percentages are in a column. I have made a spreadsheet where we manually put this column in as a diagonal so it reflects the occupancy of corresponding day. I have linked to a sample of this. I have put the March 31 data from 'data' in as I would like to see it displayed on 'sheet1'.
Any way to get the data from 'data' to automatically transpose or display on sheet 1? It would also need to move down a date row (sheet1) for each date column (data) that is filled.
I hope I am explaining this clearly. Let me know if I need to clarify.
Thanks!
https://docs.google.com/spreadsheets/d/1-PQ1GXRmsXrd7u9SHBT-gZkSYE6oLKkMttndmULEomY/edit?usp=sharing
You can put this into C2 and drag across that top row.:
=ARRAYFORMULA(IFERROR(Data!$B$2:$B$29/IF((COLUMN()-1=ROW(Data!$B$2:$B$29)),1,0),""))
If you insist on a single cell array formula then this works:
=ARRAYFORMULA( {IFERROR(Data!$B$2:$B$29/IF((2=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((3=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((4=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((5=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((6=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((7=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((8=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((9=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((10=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((11=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((12=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((13=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((14=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((15=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((16=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((17=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((18=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((19=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((20=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((21=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((22=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((23=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((24=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((25=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((26=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((27=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((28=ROW(Data!$B$2:$B$29)),1,0),""),IFERROR(Data!$B$2:$B$29/IF((29=ROW(Data!$B$2:$B$29)),1,0),"")})
You must delete all cells that in the range to be filled by the array formula for it to work (C2:AD29).