I want to automatically select a cell 12 rows higher than the last cell of data in a column. I used the tips in this thread (excel function to find last number in column) to automatically select the last cell of data using Lookup(9.99E+307,A1:A1000), but I am having trouble selecting the cell 12 rows above that. Would ADDRESS work for this? Any help is appreciated.
You can use INDEX and MATCH:
=INDEX(A1:A1000, MATCH(9^99, A1:A1000)-12)
MATCH works a little like LOOKUP, but instead of returning a value, it returns the row number where there was the last number. INDEX picks this row number up and returns the value in that particular row, minus 12.
Related
I need a formula that'll automatically populate the End Date column (see screenshot below) with the corresponding end date on the right hand side. For example for row 7 the End Date would be 08-oct since the rightmost populated cell for that row falls under the date column 08-oct.
I realise for rows 5 and 6 there is only one populated cell, so I'm guessing by default the formula will take the date there as the End Date, even though that's technically the Start Date. That's OK.
Please ignore the numbers, e.g. 0.5, 2.0, they just represent the number of resources on that phase of the project. I just need the formula to look through that row of cells, choose the rightmost one that is not empty and then take the date in that cell's column header.
Much appreciated and thanks in advance!!
Pete
So in B3, for example, assuming your header dates are in row 2 (not merged cells otherwise row 1)
=INDEX($2:$2,,MATCH(99^99,3:3))
You can then drag down. It looks to find where the last cell with a number in is within the specified row. The number it returns is used to index into the header row to return the corresponding date.
In B3 write =LOOKUP(2,1/(3:3>0),$2:$2).
Was thinking more belt and braces so i used
=IFS(O2<>"",$O$1,N2<>"",$N$1,M2<>"",$M$1,L2<>"",$L$1,K2<>"",$K$1,J2<>"",$J$1,I2<>"",$I$1,H2<>"",$H$1,G2<>"",$G$1,F2<>"",$F$1,E2<>"",$E$1,D2<>"",$D$1,C2<>"",$C$1)
for row 2 end date
screen shot of excel
Hello,
I have 3 columns in my excel sheet. Column A is item number, Column B is file Name, Column C is the date/time that file was modified(it is called matched in excel). I created a column D called versioning by comparing date and time of files with the same item number, right now I am doing this manually, Is it possible that it can be automated?
Thanks in advance!
Assuming your data has column headings in row 1, so data begins on row 2 and version begins on cell D2 and, just say your data stretches down to, say, row 100, you could use the following formula in cell D2:
D2: =COUNTIFS($A$2:$A$100,A2,$C$2:$C$100,"<="&C2)
Basically, you're saying For every file with the same Item number, how many have a date/time less than or equal to this row's?
That will, in effect, give you a version number.
As requested in the comment, to explain this formula in a bit greater depth, let's break it down:
Heading Match:
CountIfs($A$2:$A$100,A2:
This portion is saying "Only count if the value in $A$2:$A$100 = the value in A2" - Therefore, only count rows where the item number is the same as the one in the current row
Versioning:
CountIfs($C$2:$C$100,"<="&C2:
This portion is saying "Count the number of dates LESS THAN OR EQUAL TO C2" - Therefore, how many dates do we have that are less than or equal to the date in this current row.
So, if you put them both together, you get:
1) Only count a value with the item number is the same as this current row
2) And, of those, how many rows contain a date that is less than or equal to the date contained in the current row.
That, in effect, gives you a version number for every row.
Hope that does it.
Try this in your cell D2: (you may need to make the ranges bigger):=1+SUMPRODUCT(($A$2:$A$18=A2)*($C$2:$C$18>C2))
Is it possible (with a formula preferably) to count the number of blank cells in row, where the counting starts at a given column and counts going backward (e.g. right to left) the number of blank cells until a non-blank cell is found? In the example below, the counting begins at Column H and proceeds leftward. Using COUNTA or COUNTIF seem like reasonable tools to use, but I am unsure on how to terminate the counting once a non-blank cell is found.
You can use something like this if the values in your table are all text:
=COUNTBLANK(INDIRECT(CHAR(97+MATCH("zzzz",B2:H2))&ROW()&":H"&ROW()))
MATCH("zzzz",B2:H2) returns the column number in which the last non-blank cell is.
CHAR(97+ column number) returns the letter of that column.
Append it to the row number to give the reference where the COUNTBLANK has to start with &ROW()
&":H"&ROW()) gives the reference of the last cell, which is H plus the row number.
INDIRECT turns the concatenated text into a range that Excel can evaluate.
Try this formula
=COLUMNS(B2:H2)-MATCH("zzzz",B2:H2)
You could use nested if statements
=IF(ISBLANK(H2),IF(ISBLANK(G2),IF(ISBLANK(F2),IF(ISBLANK(E2),IF(ISBLANK(D2),IF(ISBLANK(C2),IF(ISBLANK(B2),IF(ISBLANK(A2),8,7),6),5),4),3),2),1),0)
My question is how can I find an intersecting cell of a specific column and row number?
My situation is this: with some calculations I find two cells, lets say B6 and E1. I know that I need a row of the first one and a column of the second one. So I could just use ROW and COLUMN functions to get the numbers. After that, I need to find an intersecting cell. Which would be E6 in this example.
I would just use INDEX(A1:Z100;ROW;COLUMN) but I don't know the exact area that I'm going to need - it depends on other stuff. I could use something like A1:XFG65000 but that is way too lame. I could also use a combination of INDIRECT(ADDRESS()) but I'm pulling data from a closed workbook so INDIRECT will not work.
If this would help to know what is this all for - here's a concrete example:
I need to find limits of a section of a sheet that I would work with. I know that it starts from the column B and goes all the way down to the last non-empty cell in this column. This range ends with a last column that has any value in first row. So to define it - I need to find the intersection of this last column and the last row with values in B column.
I use this array formula to find the last column:
INDEX(1:1;MAX((1:1<>"")*(COLUMN(1:1))))
And this array formula to find the last row:
INDEX(B:B;MAX((B:B<>"")*(ROW(B:B)))
Last column results in E1 and last row results in B6. Now I need to define my range as B1:E6, how can I get E6 out of this all to put into the resulting formula? I've been thinking for a while now and not being and Excel expert - I couldn't come up with anything. So any help would really be appreciated. Thanks!
You can use an Index/Match combination and use the Match to find the relevant cell. Use one Match() for the row and one Match() for the column.
The index/match function to find the last cell in a sheet where
column B is the leftmost table column
row 1 is the topmost table row
data in column B and in row 1 can be a mix of text and numbers
there can be empty cells in column B and row 1
the last populated cell in column B marks the last row of the table
the last populated cell in row 1 marks the last column of the table
With these premises, the following will return correct results, used in a Sum() with A1 as the starting cell and Index to return the lower right cell of the range:
=SUM(A1:INDEX(1:1048576,MAX(IFERROR(MATCH(99^99,B:B,1),0),IFERROR(MATCH("zzzz",B:B,1),0)),MAX(IFERROR(MATCH(99^99,1:1,1),0),IFERROR(MATCH("zzzz",1:1,1),0))))
Since you seem to be on a system with the semicolon as the list delimiter, here is the formula with semicolons:
=SUM(A1:INDEX(1:1048576;MAX(IFERROR(MATCH(99^99;B:B;1);0);IFERROR(MATCH("zzzz";B:B;1);0));MAX(IFERROR(MATCH(99^99;1:1;1);0);IFERROR(MATCH("zzzz";1:1;1);0))))
Offset would seem to be the way to go
=OFFSET($A$1,ROW(CELL1)-1,COLUMN(CELL2)-1)
(The -1 is needed because we already have 1 column and 1 row in A1)
in your example, =OFFSET($A$1,ROW(B6)-1,COLUMN(E1)-1) would give the value in E6
There is also ADDRESSS if you want the location: =ADDRESS(ROW(B6),COLUMN(E1)) gives the answer $E$6
The following webpage has a much easier solution, and it seems to work.
https://trumpexcel.com/intersect-operator-in-excel/
For example, in a cell, type simply: =C:C 6:6. Be sure to include one space between the column designation and the row designation. The result in your cell will be the value of cell C6. Of course, you can use more limited ranges, such as =C2:C13 B5:D5 (as shown on the webpage).
As I was searching for the answer to the same basic question, it astounded me that there is no INTERSECT worksheet function in Excel. There is an INTERSECT feature in VBA (I think), but not a worksheet function.
Anyway, the simple spacing method shown above seems to work, at least in straightforward cases.
Basically I have a large set of data in excel, and I was wondering how to count across a row how many cells are not #N/A?? I think it should be possible with IF and SUM but I'm not entirely certain.
To count all values except blanks and #N/A errors try COUNTIFS like this for data in row 2
=COUNTIFS(2:2,"<>#N/A",2:2,"<>")
If you don't want to count duplicates then this version will give you a count of all different values (except blanks and errors)
=SUM(IF(1-ISERROR(2:2),(2:2<>"")/COUNTIF(2:2,2:2&"")))
that's an "array formula" that needs to be confirmed with CTRL+SHIFT+ENTER
Note that the first formula uses COUNTIFS function and therefore will not work in versions of excel before 2007 - this is an alternative that will work in those versions
=COUNTA(2:2)-COUNTIF(2:2,"#N/A")
Try using =COUNTIF(RANGE, VALUE), here's an example that will count the numer
=COUNTIF(A:A, "Yes")
or
=COUNTIF(A1:D16, "Yes")
To count the cells that contain a value (I.E., are not empty) then use `=COUNTA(A:A)
When you want to "mark" the duplicates, use this in an empty column:
=COUNTIF($A$2:$A2,A2)>1
Puth the formula is row 2 and copy this all the way down to the last used row.
(What I usually do: Somewhere in column A, press [Ctrl]+[Down], to jump to the last item, then move sideways to the column where you want to put your formula in and put something e.g. an "X". Then jump all the way up [Ctrl]+[Up], put the formula in row 2, copy it and press [Shift]+[Ctrl]+[Down] to mark the wole range in this column from row 2 to the last used row, and press [Enter] to paste your formula.)
In this formula, the search area increases, the further you copy this down.
So this first time a duplicate item is found, the value will be 1 (i.e. false) the second, third or more times this duplicate item is found, the value will be greater than 1 and give a value of true.