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.
My goal is to write information in one column, and have it duplicated to another column. Lets say I have my data in cell =A3. I would like this data to automatically be copied into cell =Z50. The only way I know to do this without manually and writing the data or copy and pasting the cells is to go to cell =Z50 and in the function bar set it equal to =A3. I was hoping someone might know of a way to automate this process. By setting the column Z equal to the A column with the same row.
I was looking for the same thing, and even though I haven't tried the ArrayFormula solution, this could be another way to get this automatically copying done:
=QUERY(MySheet!B1:B100,"SELECT *")
Use this formula where you have planned to get the information copied.
"MySheet!B1:B100" = This will be the sheet you want to get data copied from.
"SELECT *" = This will get everything in this interval copied, in case you want any specific data into the interval, you have the option of choosing as well.
I found this tip at: https://productforums.google.com/forum/#!topic/docs/31xTcOHNRJM
This formula might work in cell Z50 (or anywhere else on the sheet that you want the data copied to):
=ArrayFormula(IF(A3:A="",,A3:A))
I need tu sum several cells that are separated one from another, these cells are
C3,F3,I3,L3,O3,R3,U3,X3,AA3,AD3,AG3,AJ3,AM3,AP3,AS3,AV3,AY3,BB3,BE3,BH3,BK3,BN3,BQ3,BT3,BW3,BZ3,CC3,CF3,CI3,CL3,CO3
if this other cells $C$1,$F$1,$I$1,$L$1,$O$1,$R$1,$U$1,$X$1,$AA$1,$AD$1,$AG$1,$AJ$1,$AM$1,$AP$1,$AS$1,$AV$1,$AY$1,$BB$1,$BE$1,$BH$1,$BK$1,$BN$1,$BQ$1,$BT$1,$BW$1,$BZ$1,$CC$1,$CF$1,$CI$1,$CL$1,$CO$1
that are on the same column but different row are >= to certain number given and <= to other given number, but it returns #Value, can somebody help me find out what am I doing wrong?
This is the function i am writing:
=SUMIFS((C3,F3,I3,L3,O3,R3,U3,X3,AA3,AD3,AG3,AJ3,AM3,AP3,AS3,AV3,AY3,BB3,BE3,BH3,BK3,BN3,BQ3,BT3,BW3,BZ3,CC3,CF3,CI3,CL3,CO3),($C$1,$F$1,$I$1,$L$1,$O$1,$R$1,$U$1,$X$1,$AA$1,$AD$1,$AG$1,$AJ$1,$AM$1,$AP$1,$AS$1,$AV$1,$AY$1,$BB$1,$BE$1,$BH$1,$BK$1,$BN$1,$BQ$1,$BT$1,$BW$1,$BZ$1,$CC$1,$CF$1,$CI$1,$CL$1,$CO$1),">="&B55,($C$1,$F$1,$I$1,$L$1,$O$1,$R$1,$U$1,$X$1,$AA$1,$AD$1,$AG$1,$AJ$1,$AM$1,$AP$1,$AS$1,$AV$1,$AY$1,$BB$1,$BE$1,$BH$1,$BK$1,$BN$1,$BQ$1,$BT$1,$BW$1,$BZ$1,$CC$1,$CF$1,$CI$1,$CL$1,$CO$1),"<="&C55)
I'm not 100% certain, but it looks like the problem here is that SUMIFS requires arguments to be expressed in continuous-range form, e.g. A3:CO3. It looks like you're trying to work with every third column in the dataset, yes? As far as I can tell, this is best (only?) done as an array function, so that you can tell it to filter on "every third column."
Enter this in the cell, then press CTRL+SHIFT+Enter (CSE) to evaluate it as an array function:
=SUM(($A$1:$CO$1>=B55)*($A$1:$CO$1<=C55)*(MOD(COLUMN(A3:CO3),3)=0)*(A3:CO3))
You'll also need to hit CSE every time you evaluate or change it. There's a decent tutorial for array functions at https://support.office.com/en-za/article/Guidelines-and-examples-of-array-formulas-7d94a64e-3ff3-4686-9372-ecfd5caa57c7, which may help if you're unfamiliar with them.
I have a sheet where the columns are months in a year and the rows are various metrics. Every month, we add another column on the right.
I need something that I can give a ROW and it will always return the right most value. That is, it automatically updates whenever we add a column for a new month.
There's a few ways of doing it, but one way (considering row 2 in this example):
=FILTER(2:2,COLUMN(2:2)=MAX(FILTER(COLUMN(2:2),LEN(2:2))))
I was very happy to have found #AdamL's answer and it did make my day, but I have since found a simpler way that works fine for my data sample, and that is using the LOOKUP function.
The LOOKUP function will look for a certain value in a given range, but if you pass it a humongous value, a value that is over your data range, it returns the last, rightmost value by default.
The answer is then very simple, just pass it the range - or row if that's what you need - and a huge value (many people do this using the biggest number that Excel can handle, but Google sheets is not Excel, and since I don't know what is the biggest number Google sheets can handle, I'll just give it a value well outside of my data set). Assuming you need to lookup into the entire row number 2:
=LOOKUP(999999999,2:2)
And that's it.
This function will throw an error if there isn't any data, so if you (like me) need to get that particular value only if it exists, you can combine this with a simple IF function:
=IF(ISERROR(LOOKUP(999999999,2:2)),"EMPTY",LOOKUP(999999999,2:2))
You can replace the string "EMPTY" with any value or function you want in there if the LOOKUP function returns an error.
I hope this simpler method is of any help, and thanks again to #AdamL for his original answer.
Adding this one for future readers. The formula I found years ago for obtaining the rightmost value was:
=index(2:2,1,COUNT(2:2))
However for each blank cells in amongst the cells with data, the returned value is the Nth last value (2 blank cells in row 2 and the formula will return the 3rd last value from the right, not the rightmost value). It appears to work, but won't be accurate in all cases.
As such, I do not recommend this formula as you can not depend on it if ever there will be an empty cell before the right-most within your data.
I have, I hope at least, a very simple question.
I have a simple sheet with the 3 first columns being a table of results, and a bunch of options that I can fill in some columns on the right. Obviously, the values in the table are supposed to change when I change the different options.
The formulas are very simple : =B2+F9 (each value in the table is based on the previous entry, the first one being specified in the options.
When I select the cell, grab the little square on its bottom right and drag it down it generates something like this :
=B2+F9
=B3+F10
=B4+F11
=B5+F12
It's basically incrementing each reference... wich is the probem I face as the F9 reference is an option and should not change.
What I want basically is something like :
=B2+F9
=B3+F9
=B4+F9
=B5+F9
Thus incrementing the B column, but not the F9 cell.
I tried to "hard-write" some of the first cells, kind of telling him "keep this F9" but without any success :(
How am I supposed to do this ? :'(
Use absolute references for that. In your case, you'd have the following:
=B2+F$9
The $ symbol means that the row is absolute, and should not change when you extend the formula. So, it would generate:
=B2+F$9
=B3+F$9
=B4+F$9
...
If you want the column to be fixed, you can reference it like $B2, for example. And if both the column and the row must be fixed, you'd use $B$2 syntax.