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).
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 am hoping someone can help me out.
I have 2 different datasets and I am hoping to replicate something like the maxifs function using an arrayformula so that I only need 1 formula and do not need to drag it down.
What I would like to do is return a value that matches a name, and the date is less than or equal to a date in the column. Basically the most recent value that matches those criteria.
I have added a picture below
DEMO FIXED
The maxifs formula I am trying to replicate in this case is: =maxifs(I:I, A:A, G:G, H:H, "<=" & B:B)
Sample Sheet: https://docs.google.com/spreadsheets/d/1mMMT1JbBMTAM0togUFQtctpY5FKzgVaP2_YKnALoHAE/edit?usp=sharing
Thank you in advance.
UPDATE:
I have this formula
=arrayformula(if(len(A2:A), vlookup(A2:A&B2:B, {H2:H&I2:I, J2:J}, 2, false),))
Which almost does what I want, however if there is no date matching i need the value from the next most recent date. Instead this returns an error.
Your new goal has nothing to do with your post. Your image values don't match your sheet, and you don't want a max or equivalent to MAXIFS at all now. So the entire post will be confusing to other contributors and future site visitors. Consider spending adequate time to rework your post question, image and spreadsheet to accurately reflect your new goal in a unified way.
That said, I've added a new sheet ("Erik Help") with a formula highlighted in green which accomplished your new goal as I understand it:
=ArrayFormula(IF(A2:A="",,VLOOKUP(A2:A&"~"&B2:B,SORT({G2:G&"~"&H2:H,I2:I},1,1),2,TRUE)))
ADDENDUM (based on additional comment from OP):
I've modified the formula as follows:
=ArrayFormula(IF(A2:A="",,IFERROR(IF(REGEXEXTRACT(VLOOKUP(A2:A&"~"&B2:B,SORT(G2:G&"~"&H2:H),1,TRUE),"(.+)~")<>A2:A,"no match",VLOOKUP(A2:A&"~"&B2:B,SORT({G2:G&"~"&H2:H,I2:I},1,1),2,TRUE)))))
I'm creating a Google Sheet documenting how many times a certain item appears in a video game with the formula in the D column (formatted to a percent):
=IFERROR(C2/SUM(C2:C51))
I want the "C2" cell to apply down the column (C3, then C4, you get the idea), but I want the "C2:C51" array to stay constant while the C2 part gets applied down the down the column. How could I modify the formula to do this? (I could manually edit the formulas all the way down, I only have 50 rows, but I think it would be helpful to learn for the future)
Try this:
=iferror(C2 / sum(C$2:C$51))
See absolute and relative references.
Alternatively, try this array formula that fills a whole column in one go:
=arrayformula(iferror(C2:C51 / sum(C2:C51)))
Below is a sample of the Google Sheet I'm working on:
https://docs.google.com/spreadsheets/d/1LDsfn_FMdUSfuFZAyuXf5gdlOSN9yLqhT1RY8aX7Nfs/edit?usp=sharing
On the spreadsheet Team Totals, I'm trying to calculate all the sales based on the date, the type of sale, and the program type starting from Row 27.
The problem I have run into is that the Named Range, Consultants, only pulls the data from the first cell of the Named range (Octo). What I want is for a formula that will pull the data of the selected range from each entry in the named range and sum them together.
For reference, I put what the proper values should be starting from Row 33.
The closest example I have seen was from this website: https://www.got-it.ai/solutions/excel-chat/excel-tutorial/sumif/sumif-across-multiple-sheets
However, I get the same problem that only the first cell in the named range gets pulled.
I feel like I'm missing something simple, but I have been bouncing it around my head for hours and can't figure it out. Any help is greatly appreciated.
So after trying to figure out a way not to use an iterative process, I folded and did this:
=arrayformula(SUMIFS(INDIRECT("'"&$B$4&"'!F6:F100"),INDIRECT("'"&$B$4&"'!D6:D100"),$B$2,INDIRECT("'"&$B$4&"'!E6:E100"),E$27,INDIRECT("'"&$B$4&"'!A6:A100"),$A41)+
SUMIFS(INDIRECT("'"&$B$5&"'!F6:F100"),INDIRECT("'"&$B$5&"'!D6:D100"),$B$2,INDIRECT("'"&$B$5&"'!E6:E100"),E$27,INDIRECT("'"&$B$5&"'!A6:A100"),$A41)+
SUMIFS(INDIRECT("'"&$B$6&"'!F6:F100"),INDIRECT("'"&$B$6&"'!D6:D100"),$B$2,INDIRECT("'"&$B$6&"'!E6:E100"),E$27,INDIRECT("'"&$B$6&"'!A6:A100"),$A41)+
SUMIFS(INDIRECT("'"&$B$7&"'!F6:F100"),INDIRECT("'"&$B$7&"'!D6:D100"),$B$2,INDIRECT("'"&$B$7&"'!E6:E100"),E$27,INDIRECT("'"&$B$7&"'!A6:A100"),$A41)+
SUMIFS(INDIRECT("'"&$B$8&"'!F6:F100"),INDIRECT("'"&$B$8&"'!D6:D100"),$B$2,INDIRECT("'"&$B$8&"'!E6:E100"),E$27,INDIRECT("'"&$B$8&"'!A6:A100"),$A41)+
SUMIFS(INDIRECT("'"&$B$9&"'!F6:F100"),INDIRECT("'"&$B$9&"'!D6:D100"),$B$2,INDIRECT("'"&$B$9&"'!E6:E100"),E$27,INDIRECT("'"&$B$9&"'!A6:A100"),$A41))
This formula allows me to cut and paste it to various cells easily, and does the job I need it to, while still using the indirect reference so I can change names without breaking the formula (granted I change the worksheet name as well).
I will need to edit this to include all possible worksheet amounts I can forsee, but once it's done, I won't have to tinker with names anymore.
I'm not happy with this answer, as it creates a really long and ugly formula, essentially repeating the same formula 20 times, but it does work. I feel like there should be an easy function that would be able to do this.
This will return Total sales:
=if(isna(ArrayFormula(QUERY({Lo!$A$5:$F; Tulio!$A$5:$F;Ya!$A$5:$F; Miguel!$A$5:$F;Kevin!$A$5:$F; Octo!$A$5:$F}, "select sum(Col6) where Col1=date '"&TEXT(A28,"yyyy-mm-dd")&"' label sum(Col6) ''",0)))=TRUE,0,ArrayFormula(QUERY({Lo!$A$5:$F; Tulio!$A$5:$F;Ya!$A$5:$F; Miguel!$A$5:$F;Kevin!$A$5:$F; Octo!$A$5:$F}, "select sum(Col6) where Col1=date '"&TEXT(A28,"yyyy-mm-dd")&"' label sum(Col6) ''",0)))
BTW, I get Total sales of $0, $615.50 and $2,498.00
The best way to pull data from a lot of unknown tab names without a script is to actually CREATE the tab names beforehand. On your sheet it looks like you're anticipating/making space for 21 employees. If I were you, I would just create 15 more tabs named Temp7,Temp8,Temp9... etc. Then you can just "hide" those tabs. Then a formula can be built in your totals section that will easily stack all the tabs up using an array literal and a QUERY( { } ) to add up the totals for you without all this INDIRECT() nonsense that you have been going through to pull from the individual tab names.
Would pre-adding tab names be something you were interested in if I could show you the formulas to make the totals easy to calculate?
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.