Get the 10 lastest not blank value cell in one column - google-sheets

This formula looks for the last cell that is not blank in a specific column. I'd like to get the values from the last 10 nonempty cells in the column.
=FILTER(H:H , ROW(H:H) =MAX( FILTER( ROW(H:H) , NOT(ISBLANK(H:H)))))
At the moment I can get the value of the last non-empty cell, I would like to know what I need to adjust in order to get the values of the last 10 non-empty cells of a specific column.

use query instead:
=QUERY(A:A, "where A is not null offset "&COUNTA(A:A)-10, 0)

Related

Conditional Formatting (Google sheet)

I am trying to format a group of cells but I need a custom formula for when the value of a cell is greater than the value of the cell in its column of a specific row it needs to be highlighted
(The highlighted value reference point in the group is in the same row)
Please help 😞
I tried to highlight by using the default option on each column but there are way too many rows
I don't have your exact spreadsheet. Let's say your range goes from A1:Z, and that the column of reference is column E (from each row). Then you can set this formula to:
=A1 > $E1
Change A1 to the first cell of your range and $E1 with the first corresponding column of the first row of the rage (if you start row 3, then put $E3 -- and change the letter ;) )
Let me know if this works for you!

Array formula and MAX value of 2 cells

I'm trying to get max value between 2 cells (one is same column, previous row, another is in the same row, but different column) with an array formula. I use array, because I need it to be updated automatically row after row with each new entry in column A without adding formula to new cells each time.
Just MAX formula is following:
I3512=MAX(I3511,C3512)
This array formula gives same result in each following cell
I3513 = ARRAYFORMULA(IF(ISBLANK(A3513:A),,MAX(I3512,C3513)))
This formula also, gives me the same result in each row, as counting the max from C column.
I3513 = ARRAYFORMULA(IF(ISBLANK(A3513:A),,MAX(I3512:I,C3513:C)))
Also I tried this version, but it fails in the middle, showing wrong values.
I3513 = ARRAYFORMULA(IF(ISBLANK(A3513:A),,if(I3512:I<C3513:C,C3513:C, I3512:I)))
How to apply MAX formula to all rows in column I after row 3513, finding between previous cell and another column same row.
Suggested formula result
if just two columns use IF in row 3513:
=ARRAYFORMULA(IF(A3513:A="";; IF({I3512:I; ""}>C3513:C; {I3512:I; ""}; C3513:C)))
Use OFFSET
For example:
C3 =
{
"MAX PNL";
"N/A";
ArrayFormula(
IF(
OFFSET(A3:A1000, -1, 0) > B3:B1000,
OFFSET(A3:A1000, -1, 0),
B3:B1000
)
)
}
Bear in mind with this technique you can't use ranges like A3:A as this will give you an error:
This is because since it references two rows, it gets confused and always requires more rows.

Arrayformula to compare two columns and skip blank cells

I have two columns on two different sheets with a long list of values; I'm trying to compare these two columns to check if an entry in the first one exists in the second one. In the first column there are also blank cells.
I tried different formulas but all of them is returning a value for blank cells, instead of a blank cell.
These are the formulas I tried:
=arrayformula(iferror(if(match(A1:A,AnotherSheet!A1:A,0),"yes"),"no"))
=query(arrayformula(iferror(if(match(A1:A,AnotherSheet!A1:A,0),"yes"),"no")), "Select * where Col1<>''")
=query(arrayformula(iferror(if(match(A1:A,AnotherSheet!A1:A,0),"yes"),"no")), "Select * where Col1 is not empty")
All of them is returning "no" for blank cells in the first column, I would like to have a blank cell instead. Thank you
=ARRAYFORMULA(IF(LEN(A1:A), IFERROR(IF(MATCH(A1:A, AnotherSheet!A1:A, 0), "yes"), "no"), ))

How to use index match formula that automatically expands in Google Sheets

In Google Sheets I am using a filter function to pull in Names into column A and a Timestamp into column B. Every time a second occurrence of the name shows up into columns A & B of the list I want column C next to the prior occurrence to reference the new timestamp. In column D I will then calculate the difference from the names timestamp and the next occurrence of that same name.
Currently I am using the following formula:
=IFERROR(INDEX(B3:B,MATCH(A2,A3:A,0)))
If I drag this formula down it does what I need it to do, but due to how many rows are being added to the first two columns, rows are being added to the bottom of the sheet due to the filter and the formulas keep needing to be dragged down. The durations in column D are being calculated with the following formula, that automatically arrays the results and automatically expands with the filter results:
=IFERROR(ARRAYFORMULA(IF(C2:C="","",C2:C-B2:B)))
I would like my index match formula to do the same, but it seems I cannot use the index formula with an arrayformula.
I attempted to achieve this by using a vlookup combined with an offset for the range. The first row is giving me the result I want, but all the subsequent rows are not referencing the offset range, probably because the offset isn't changing with each new array result here is that attempt:
=IFERROR(ARRAYFORMULA(VLOOKUP(A2:A,OFFSET(A2:B,1,0),2,FALSE)))
Any ideas how this could be accomplished by placing a formula in one cell, or would this have to be accomplished with a script?
I have added an example spreadsheet of the current method HERE
Thanks in advance for any help.
Formula
Instead of
INDEX, MATCH and OFFSET
try the following formula
=ArrayFormula(IFERROR(VLOOKUP(
TRANSPOSE(VALUE(REGEXEXTRACT(QUERY(TRANSPOSE(
IF(FILTER(ROW(A2:A),LEN(A2:A))<TRANSPOSE(FILTER(ROW(A2:A),LEN(A2:A))),
IF(FILTER(A2:A,LEN(A2:A))=TRANSPOSE(FILTER(A2:A,LEN(A2:A))),
TRANSPOSE(FILTER(ROW(A2:A),LEN(A2:A))),
),)
),,2000000),"(\d+)"))),
FILTER({ROW(A2:A),B2:B},LEN(A2:A)),2,0)))
Formula description
This part creates a square matrix showing the row number of the value that matches if it's below of the current row:
IF(FILTER(ROW(A2:A),LEN(A2:A))<TRANSPOSE(FILTER(ROW(A2:A),LEN(A2:A))),
IF(FILTER(A2:A,LEN(A2:A))=TRANSPOSE(FILTER(A2:A,LEN(A2:A))),
TRANSPOSE(FILTER(ROW(A2:A),LEN(A2:A))),
),)
This part takes the smallest row that matches the current row (the next occurrence of the row value)
TRANSPOSE(VALUE(REGEXEXTRACT(QUERY(TRANSPOSE( ),,2000000),"(\d+)")))
This part returns the related value, if any, otherwise a blank:
IFERROR(VLOOKUP( ,FILTER({ROW(A2:A),B2:B},LEN(A2:A)),2,0)))

Formula to find last value in row and label with Column Top

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.

Resources