I have an Excel Online sheet that has info coming in from a Microsoft Form. I need to find the highest non blank cell and the second non blank based on one criteria. The last non blank was easy with LOOKUP
=LOOKUP(2,1/(K2:K1000="6"),G2:G1000)
However it is proving difficult to get the penultimate non blank cell without using Array formulas. Excel Online doesn't update Arrays automatically, you have to CSE each cell which is not too timely with my number of cells. Is there a non array way of getting the second to last non blank cell contents?
I have spent a long time searching and only found ARRAY solutions or ways of getting the penultimate cell when its a number. Unfortunately my entries are text. Cheers.
As long as you can start at row 1 because row 1 are headers and so K1 cannot be 6 it could be:
=INDEX(G1:G1000,LARGE(INDEX((K1:K1000="6")*ROW(K1:K1000),0),2))
LARGE(...,2) points to second last cell fulfilling criterion in column K.
Else it must be more complex:
=INDEX(G2:G1000,LARGE(INDEX((K2:K1000="6")*(ROW(K2:K1000)-ROW(K1)),0),2))
Related
I am attempting to count the number of blanks in a large (1 million + cells) dataset, that has been pulled through using a =FILTER formula (from a larger dataset).
Due to the way Excel handles the =FILTER formula, every single cell is populated with =FILTER, even if it's only pulling a blank value.
Is there any way to count the blank values that are in the =FILTERed dataset? I've tried using =COUNTBLANK and =COUNTIF('RANGE:RANGE'=""), but because the cells aren't physically empty, they just have no value, it always yields zero.
The thing is, the same formula works fine in Google Sheets, as Google Sheets doesn't appear to put =FILTER into every cell of the filtered array. I've included an example here showing a dummy example of my dataset, including a side-by-side screenshot of how it behaves in Google Sheets Vs Excel: https://docs.google.com/spreadsheets/d/1-_mULvQG580EqSMci9gY3Ccll3yjwILTwI6TxglUQgs/edit#gid=0
Any help would be appreciated. Thanks!
The only way I know how to do it is by counting the number of rows and subtracting the cells that contain "PENDING".
=ROWS(J4:J7)-COUNTIF(J4:J7,"PENDING")
In your representative data in Excel, the cells aren't blank but have a value of 0 so you can just count that:
=COUNTIF(J4:J7,"0")
If you want a count of "true" blank cells (although COUNTBLANK should work for this) you can check the length of text in the cells using:
=SUMPRODUCT(--(LEN(J4:J7)=0))
Or
=ROWS(J4:J7)-SUMPRODUCT(--(LEN(J4:J7)>0))
So I've got a column of data that I want to count the non blank cells after a certain row.
Here's an example of what I have:
So, in this example, I would like to start counting non blank cells in column A starting on row 13 (which would be a total of 4). If you look at the formula I have entered into cell D12 I can get the value I'm looking for with this formula:
=COUNTA(A:A)-11
I could use this formula:
=COUNTA(A13:A16)
but the point is the last cell with data in it can change due to entering different amounts of data in the column.
But I'm wondering if there is a different formula I could use that would count non blank cells from a certain row down regardless of the amount of data I enter into the column from a certain row down using an open ended range, kind of like this:
=COUNTA(A13:A)
This formula doesn't work but it kind of illustrates what I tried to do that didn't work.
from my comment above:
Well, you could always get the last used row dynamically and incorporate that, not sure what your benefit is over using the last row:
=COUNTA(A13:INDEX(A:A,LOOKUP(2,1/(A:A<>""),ROW(A:A))))
This makes it somewhat "open" ended I guess. Unfortunately it isn't GS =)
I am trying to find the number of times a certain text string appears on the last inspection of a vehicle. The columns are areas to check, and each inspection is on a separate row. The range is D6:VG150 (the 150 is to allow for future inspections). The majority of cells are blank, either because I haven't used that row yet, or there was no fault found in that area during a previous inspection. The only column that will be filled is column A, which has the dates of inspection. I ONLY want results from the last inspection (to indicate current status on a fleet status worksheet). Even better would be to check the last filled cell in every column in that range, but that might be pushing it.
I have tried =COUNTIF(INDIRECT("'291'!$D$6:$VG"&INDEX(MAX((A:A<>"")*(ROW(A:A))),1)),"Schedule Repair"), but it returned the results from the entire range defined by the last range. I tried switching the first address of the range, $D$6, to $D&, but this returned a #REF! error.
I've tried to simplify your scenario. The screenshot below shows a table that starts in row 3 and extends to row 7. The formula counts how many cells in the last row of the table have the text "a". The formula is
=COUNTIF(INDEX(A:A,COUNTA(A:A)+2):INDEX(C:C,COUNTA(A:A)+2),"a")
You don't need Indirec. Index is a lot better. The first Index returns the cell A7. The second Index returns the cell C7. Using the colon as the operator will turn the two cells into a range that can then be used by Countif.
The last row is identified by counting all cells with text in column A, and then adjusting for the fact that there are empty rows above the table.
Oh, and by the way, if you use an Excel Table, you don't need to pre-fill formulas into empty rows. In an Excel Table all formulas are automatically applied to new rows.
I have a spreadsheet that I'm using to try and keep track of google keyword rankings, but I can't figure out how to track the last change in keyword ranking, meaning the last cell in the row MINUS the second to last cell in the row. I've included a picture on what I'm trying to accomplish. The formula would take, for example, in J3-I3 to get the last change of 4 shown in D3.
Right now I have this code:
=(LOOKUP(2,1/(3:3>0),3:3))-LOOKUP(9E+300,B3:INDEX(B3:J3,MATCH(9E+300,B3:J3)-1))
Which is fine, but I need to keep changing the cell references is. Is there any easier way to accomplish this?
You can use just INDEX(MATCH()) and refer to the full row.
=INDEX(3:3,MATCH(1E+99,3:3))-INDEX(3:3,MATCH(1E+99,3:3)-1)
If you have, say, 12 columns B="Jan" to M="Dec" with a formula in each, and you need to calculate the difference between the latest month's value and the previous month's value, the formula above does not work if any columns are blank but with formulas, or until you have a value for each of the 12 months.
If you want to calculate, say, Jun minus May when Jul to Dec are blank except for their formulas, this formula (for row 4) will do it for whatever the latest month with a numerical value is:
=INDEX(4:4,MAX(IF(ISNUMBER(B4:M4),COLUMN(B4:M4))))-OFFSET(B4,0,SUM(IF(ISNUMBER(B4:M4),1))-2,1,1)
It must be entered with Ctrl+Shift+Enter.
#ScottCraner has provided an answer with the right logic, which is to
locate the second last and last number in each row, and then perform a
simple subtraction between the two.
INDEX+MATCH is one way of solving the question, but in this case, given that all data are stored in a table, and to add the flexibility of
1) moving the table around or across worksheets;
2) entering numeric value in the same row outside of the table;
without incurring errors, I've used OFFSET+COLUMNS instead.
Please note in my example I have given a name to the table, called it Tbl_WordRk, and I have added some data (in the gray area) for testing purpose.
Basically, OFFSET works in similar logic as INDEX, with a known starting point (such as B3 in my example), it will find the value (or even a range of values) in another row or column as long as you know the relative position of the value compared to the starting point. For example, if your starting point is cell A1, the following OFFSET function will return the value in cell D8.
=OFFSET(A1,7,3) which is interpreted as 7 rows down and 3 columns to the right of cell A1
COLUMNS finds the total number of columns of a given range, which is perfect for finding a column position within a table. The following formula will return number 7 which is the total number of columns of the table in my example, but please note it is NOT the relative column position of the last column to cell B3.
=COLUMNS(Tbl_WordRk)
You need to add -1 to the above formula to find the relative column number of the last column from B3. And therefore, adding -2 will return the relative column position of the second last column from B3.
So the final formula in cell B3 in my example is
=OFFSET(B3,,(COLUMNS(Tbl_WordRk)-2))-OFFSET(B3,,(COLUMNS(Tbl_WordRk)-1))
Then you just drag it down to the last row.
Just one more advice on the conditional format of your example, I would prefer not to show a green upward arrow if there is no change in the word ranking. If you know how to edit an existing conditional formatting, here is how to set it:
Cheers :)
I have a spreadsheet that acts as a drawing register.
The first 5 columns make up the drawing name/number. I place the revision number of the drawing in each subsequent column. Some of these columns appear blank, but have formulas for other functions in the worksheet.
I would like the first column after the drawing name/number (col F in this case) to display the latest revision number.
Essentially this means I need a formula (or VBA code) to search for the last non-empty cell in a row, but ignoring cells that have formulas in them (that appear blank).
Find the last not empty row in a range of cells holding a formula is very similar but refers to the last row in a column (I am looking for the last column in a row). I couldnt adapt it. I think my syntax was incorrect.
To mention a few extra points:
The revisions are alphanumeric
The revisions are in pairs (as each drawing has a status code and revision, both of which are alphanumeric) and in the first 2 columns (F and G) I need to show the latest status and revision respectively. The status and revision are placed in adjacent columns on the same row each time. So in reality I need a formula that will return the last 2 non-empty columns and the formula needs to ignore cells that contain formulas that return a blank value.
I have tried various combinations of Lookup (similar to Ron's response below), index and VBA code as shown in the above link. If possible I would like to keep it as a formula but I am not adverse to using VBA.
The formula only needs to apply to an individual row, but needs to be copied down as each separate drawing is on a new row.
If the revision number might be either text or numeric, you can try:
=LOOKUP(2,1/(LEN($G5:$XFD5)>0),$G5:$XFD5)
Please try (in F1 and copied down to suit):
=INDEX(G1:Z1,MATCH(1E+100,G1:Z1))
Z may be increased if you expect to require more columns.
Formulae that return blanks should be ignored by the above.