I'm using Google Sheet for a annual badget tracking.
I'm trying to figure out how sort 20 top categories from a specific range (categories and prices) but i get an error all the time and i can't understand what i'm doing wrong.
This is my formula and where I stuck:
=SORTN(UNIQUE(FILTER(FLATTEN(P21:P40,W21:W40,I46:I65,P46:P65,W46:W65),FLATTEN(P21:P40,W21:W40,I46:I65,P46:P65,W46:W65 <>"")),20,0,FILTER(FLATTEN(T21:T40,AC21:AC40,N46:N65,T46:T65,AC46:AC65),FLATTEN(P21:P40,W21:W40,I46:I65,P46:P65,W46:W65)<>""),0,1,1)
seems the problem coming from the second part:
FILTER(FLATTEN(T21:T40,AC21:AC40,N46:N65,T46:T65,AC46:AC65),FLATTEN(P21:P40,W21:W40,I46:I65,P46:P65,W46:W65)<>""),0,1,1)
This is the error i got:
Error
FILTER has mismatched range sizes. Expected row count: 60. column count: 1. Actual row count: 100, column count: 1.
Could please anyone help me?
I think your formula should have been
=SORTN(UNIQUE(FILTER(FLATTEN(P21:P40,W21:W40,I46:I65,P46:P65,W46:W65),FLATTEN(P21:P40,W21:W40,I46:I65,P46:P65,W46:W65 <>""))),20,0,FILTER(FLATTEN(T21:T40,AC21:AC40,N46:N65,T46:T65,AC46:AC65),FLATTEN(P21:P40,W21:W40,I46:I65,P46:P65,W46:W65)<>""),0,1,1)
I can't prove this definitively without test data, but the missing 40 rows are almost certainly because your sheet only goes up to column Z so AC21:AC40 and AC46:AC65 aren't included. If you insert more columns to the right without changing the formula, the error goes away.
Related
I've been working on a document based on google forms answers to calculate picture revisions.
This is the formula that I am trying to use: =SORTN(FILTER('Raw Data'!G:G,'Raw Data'!C:C=B1,'Raw Data'!E:E,"No"),20,0)
What I am trying to accomplish, is to pull 20 pictures per day of "bad parking". So I use 2 filters: bad parking and reviewed date. Yet it gives me an error saying there is a missmatch. I have reviewed the size and the reference is the full row. I have tried numbering the range (like G1:G99999) but nothing works. I am under the impression that the error is misleading me, I had the same issue in the array I am using to importrange the responses and I solved it by cutting the range into 3 pieces.
Here is the link to the spreadsheet I am working on: https://docs.google.com/spreadsheets/d/1fc3RbMwPCI2Txcy67WfqoPLDGPrUFF0JYuTMKEnXDFI/edit#gid=1067703029
change
,"No"
to
="No"
=SORTN(FILTER('Raw Data'!G:G,'Raw Data'!C:C=B1,'Raw Data'!E:E="No"),20,0)
To give some detail, I am using Google Forms + Google Sheets to make an easy database that collects all the bank information I put in (Income, savings, expenses, etc.) and I can keep track of details with easy sorting.
I'm stuck on a formula that I can't seem to figure out. Before I go in to specific details of my code I will give a small explanation. The cell I am trying to populate [with the formula] is supposed to take 2 pieces of information from the form response sheet (I will refer to it as 'rawdata') and produce a value (number) from another cell in 'rawdata'.
So in 'rawdata' I have a column (B) that has a value of "Expense" or "Income" for a form response line. I have a column (D) in 'rawdata' that has the value of "Amount" for the number submitted.
Cells in reference in 'rawdata':
B9 = "Expense"
D9 = 67.37
Now, due to the original 'rawdata' being a form response sheet it inserts new rows every response, so my attempt at just calling direction to the cell fails upon a new response submission because it increments on its own. So that being a solution is out of the question.
So, for every other cell I am using to display values from 'rawdata' in an organized sheet I use =INDEX() to pull the value from that exact row and column, instead of the cell reference and it has worked so far.
=INDEX(rawdata!$B:$B,ROW(9:9)) displays "Expense" from 'rawdata' in B9 as a result. So the rest of the cells are formulated this way and I have had no issues.
When I got to the amount, I used an =IF() formula to pull the value from the D column and to display it either as a negative or positive depending on what column B states.
=IF(rawdata!B8="Expense", -rawdata!$D9, rawdata!$D9) displays -67.37 as a result.
But since I can't use this formula to fill empty cells for future use I have to find another way to do so. I figure;
=IF(=INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
is my solution to the problem, because to me it makes sense. But it fails and gives me a Parse Error.
So when I try to run the first =INDEX() with the values of 1 or 0 being the outcome of the =IF() it also fails, so I create a new column in the sorted table to pull the data of "Expense" or "Income" so I can reference that.
Cell in 'processeddata':
E9 = "Expense"
=IF(E9="Expense", 1, 0) displays 1 as its result, so I figure this is the solution to my problem.
=IF(E9="Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
displays #ERROR with the description Parse Error.
=INDEX(-rawdata!$D:$D,ROW(9:9)) displays -67.37
=INDEX(rawdata!$D:$D,ROW(9:9)) displays 67.37
I'm at a loss for what to do now. I've exhausted myself with tons of searching on here and all over google, tried using things like INDEX and MATCH, VLOOKUP, etc but can't solve this to save my life. Does anyone here have a clue how I can solve this with a cell reference that won't increment when new rows are added in 'rawdata'?
PS. I've also attempted using =VALUE() to try and convert the =INDEX() to a number but no luck.
Your formula has superfluous equals signs (=). Try Insert > Column and this formula in row 8 of the new column:
=arrayformula( if(rawdata!B8:B = "Expense", -rawdata!D8:D, rawdata!D8:D) )
Your formula has some equal signs in it that are probably the issue.
Instead of this:
IF(=INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", =INDEX(-rawdata!$D:$D,ROW(9:9)), =INDEX(rawdata!$D:$D,ROW(9:9)))
try this:
IF(INDEX(rawdata!$B:$B,ROW(9:9)) = "Expense", INDEX(-rawdata!$D:$D,ROW(9:9)), INDEX(rawdata!$D:$D,ROW(9:9)))
Also, an array formula is a great tool for Form data calculations. In this file you can see a formula in Column F that does a calculation in each row of the responses sheet from this form, it will continue to update as new entries are made. Feel free to enter submit some form responses.
I just wanted a simple way to number columns or rows in a Google Sheet, and most answers I've found offer many options that are far more complicated than I needed them to be.
Example: I want to number every column in the active sheet, starting with 1 for Column A and counting up by 1, regardless of the content of any other cells on the sheet and if I add columns to the sheet later, I want them to automatically update with the correct column numbers.
Another way is to use SEQUENCE.
So putting =SEQUENCE(99) in A1 would number the first 99 rows, from 1 to 99.
To number columns, just rotate that array, with TRANSPOSE.
So if A1 held =TRANSPOSE(SEQUENCE(26))
that would number columns A to Z with the numbers 1 to 26.
If you want to number both columns and rows,try:
in A1: =SEQUENCE(999), and
in B1: =TRANSPOSE(SEQUENCE(25,1,2))
I realise that this is numbering a specific number of rows, or columns, but I often find that very useful. You could modify this to number all columns or rows by adding some count to determine the total number of rows or columns, and using that in place of the first parameter for the SEQUENCE function.
The simplest way I've found to do this is by putting either of the following formulas in A1:
For numbering rows: =ArrayFormula(ROW(A:A))
And for columns: =ArrayFormula(COLUMN(1:1))
After putting the formula in A1, I'll usually hide the column or row the formula is in so I don't accidentally change or delete it.
If I want the counting to start at 1 on the 2nd, 3rd, or 4th row or column, then adding a -1,-2, or -3 respectively to the end of the formula gets that done.
For example: To number columns starting with 1 in Column C, the formula I put in A1 is =ArrayFormula(COLUMN(1:1)-2).
This may be way more basic than most people on this site are generally looking for, but for some reason it took me an unexpectedly long time to find it/ figure it out, so I thought maybe someone else would find it useful in the future.
In Google Sheets, I have a formula that displays the value of an item in a row if one of its cells contains any of the values listed in a different sheet. It looks like this:
=ARRAYFORMULA(IF(OR(L2 = ZRSKUs!$A$1:$Z$12005), O2, "0"))
If L2 contains any of the values in sheet ZRSKUs, this formula displays the value of the item, which is held in O2. If I drag the formula down it produces the value of every column and I can then get a SUM of this column. I wanted a way to do this without having to drag the formula down every single row (this spreadsheet has about 20,000 rows so it takes a long time to do). I also wanted the formula to add it up too, so it is all done in one cell.
I tried editing the formula to do this, and this is what I came up with:
=ARRAYFORMULA(SUM(IF(OR($L3:$L = ZRSKUs!$A$1:$A$500), $O3:$O, "0")))
However, this gives me an "Array arguments to EQ are of different size" error. I tried adjusting the number of rows in the ZRSKUs sheets so it had the exact same number as my other sheet, but this made no difference.
I'm not sure what's going wrong, so any help or advice would be greatly appreciated!
You get the error because that is not a well-formed array formula, as $L3:$L and ZRSKUs!$A$1:$A$500 are not equal in length. We could rectify this by using another function for the lookup, in this case, MATCH:
=ARRAYFORMULA(SUM(IF(ISNA(MATCH($L$1:$L, ZRSKUs!$A$1:$A$500, 0)), 0, $O$1:$O)))
I have a Google sheet for tracking my weight. I have two columns: Date and Weight. While the goal is to have the weight column sorted in descending order, that doesn't always happen in reality...
The data essentially looks like this (weights changed to far lower values, of course):
Date |Weight
04/01/10|195
04/02/10|194
04/03/10|190
04/04/10|198
etc.
Anyway, I have a cell in another spot on the sheet that shows the minimum value from the weight column using this formula
=(Min(B:B))
What I would like to do is display the corresponding date cell for whatever the minimum value from the weight column is. So, with this dataset, I want to show 190 for weight and 04/03/10 for date. Is there any way to get that corresponding cell? I looked through the function reference for Google docs, but can't get anything going. I tried using some of the functions from the Lookup category, but got nowhere. Most want a cell reference, but the min() function returns a value. I think I need to somehow get min() to give me a cell reference, but I don't know how to do that. HLOOKUP() sort of seemed like it might be appropriate, but the docs were a bit spotty, and it didn't do anything but error out the cell.
Of course, I may be barking up the wrong tree entirely.
Thoughts?
I would use the following two formula's:
MIN(B2:B)
FILTER(A2:A;B2:B=minimal value)
If there are more results, they need to be included as well.
See example file I've created: Getting Corresponding Cell In Google Docs Spreadsheet?
Not barking up the wrong tree, actually very close:
=index(A:A,match(min(B:B),B:B,0))
should meet your requirement.
Working inside out: min(B:B) (as you had) returns the lowest weight (ie 190) in ColumnB.
match then finds the position of that value relative to the start of the range in which the value is searched for. So assuming Date is in A1, that returns 4, being the fourth row in ColumnB, where 190 is. The 0 in the formula is to ensure that only the position of an exact match is returned.
Now we know we need the content of the fourth row we can go looking for the value there in ColumnA with index, returning 04/03/2010.
Not all is ideal however. It is possible that a weight of 190 was achieved on separate days. It is the nature of match that where an exact match is required and found the function stops looking for any further instances. Hence as things stand 04/03/2010 will be returned for 190 however often that is the weight for a day after 04/04/2010 - unless other steps are taken, such as to delete/remove/ignore data from 04/03/2010.
You need to change the order of the column as the search column (the weight should be the first in the search array. Then you can use the VLOOKUP formula:
=VLOOKUP(C7,A:B,2,false)
C7 holds the MIN formula that you used: =(Min(A:A)) - note the column order change
one-cell solution to get minimal value with the latest day:
={MIN(B:B), TO_DATE(VLOOKUP(MIN(B:B), SORT({B:B,A:A}, 2, 0), 2, 0))}
to get all minimal values with dates:
=QUERY(A:B, "select B,A where B matches '"&MIN(B:B)&"' order by A desc", 0)