Retrieve value of any cell in a column by inserting row number - excel

Complete newbie here, just wonder about the formula in excel to retrieve the value of any cell in a given column by inserting its row number. Example: in a cell i insert number 5, so the cell below should have the formula that allows to display the value of the cell in E5. Or better yet, if i insert 5, i would like to have value for cell with row number "5+x". Thank you and best regards

If the cell in which you insert the number is A1, the formula is
=INDIRECT("E"&A1)
To answer the edited question:
=INDIRECT("E"&(A1+x))
where x could be an integer or another cell reference.

Related

Return the column of a cell

Given a cell, I'm looking for a function and formula solution which returns its column. For instance,
Given Cell G3, I expect the formula to return Column G:G (rather than the string G:G and the column number 7)
Given Cell H8, I expect the formula to return Column H:H (rather than the string H:H and the column number 8)
Such a solution does not seem to exist in Excel today. Could anyone help?
PS: Given a Cell B3, I'm looking for a formula to return the result like what is displayed in Column I.
How about =SUBSTITUTE(INDEX(A:D,,COLUMN(B3)),"","") which will return blank if blank and 0 if value 0 in the referenced column.
I also only referenced the first 4 columns, since your search/example data starts from column 5. Excel would then always reference up untill the last row regardless the version.

Referencing parameter lookup_array in function match in excel

I want to use the match function in Excel the following way: match(True, D2:J2>=K1,0), to find the smallest value that is greater than or equal to lookup_value. My problem is how to change the row number in the array, since the row number is on his part the result of a match function.
Thanks for the help in advance!
Your baseline formula is:
=MATCH(TRUE,D2:K2>=K1,0)
which looks at row #2:
To change that row, lets put 7 in cell A1 to mean use row #7. We change the formula to:
=MATCH(TRUE,INDEX(D:D,A1):INDEX(K:K,A1)>=K1,0)
So the value in A1 defines the row that MATCH() should use.
EDIT#1:
Here is another example of using INDEX() to return a cell reference.
Say we have data in column A. We want the user to be able to select parts of the column (start and stop rows) and sum the part. However, we don't want the user to tinker with the formula. In fact we are going to lock the formula cell so the user can't destroy the formula. We tell the user to put the start row in D1 and the end row in D2.
We put the formula in cell D3:
=SUM(INDEX(A:A,D1):INDEX(A:A,D2))

How to find the column position of the last non-empty cell in a row?

I have this row, and want to know the value of the first row (dates) of the last non-empty cell. In this example, it should return 1/11/2018. Given the input of "Stock A", how do I achieve this using Excel formulas?
Try:
=LOOKUP(2,1/(A2:Y2<>""),A1:Y1)
Courtesy #barry houdini.
Assuming the data is in Sheet1, and your lookup stock code ("Stock A" in this case) is on Sheet2 cell A2, use this formula in sheet2, cell B2 to get the desired date (adjust range references to suit your actual data):
=LOOKUP(2,1/(INDEX(Sheet1!$B:$M,MATCH(A2,Sheet1!$A:$A,0),0)<>""),Sheet1!$B$1:$M$1)
Note that you'll probably need to format the formula cell as a Date so it displays the date properly instead of the Excel Datecode.

How to refer to multiple adjacent cells

I have a work sheet in which there are several cells with a specific entry - let's say "A". These are not all in the same rows/columns. After each cell is a date.
I need to count the number of cells containing "A" which also have a specific date in the cell immediately to its right. I've tried combinations of Countifs and Indirect, with no success. How can I achieve this?
This counts the number of times that there is A in column A and 1 in column B
=SUMPRODUCT(($A$1:$A$5="A")*($B$1:$B$5=1))
This outputs in cell D1
Not too difficult.
I have created a sample sheet with 8 rows and 5 columns of data.
See below, the formula in cell C12 counts the number of occurrences where the a cell with a date of October 31, 2017 is directly to the right of a cell that contains the text A.
If you want more info as to how this works, read on:
When searching for cells that contain A, you don't search in the last column of the data (in this case, column E) because it is impossible for a column to the right to have any date in it. This is why a portion of the formula says A1:D8="A" instead of A1:E8="A". This is the same reasoning why we start searching for a date in column B rather than column A in the formula.
You can achieve this with a helper row. Add additional row on top of your Worksheet. In cell "A1" enter formula below.
=COUNTIFS(A2:A2000,"A",B2:B2000,"YourDate")
Drag this formula to the rightmost of where you have data, then simply sum all values returned by formula.

Formula to select row cells starting from a certain cell

Is there a way to include in a formula the sum of the values of a row, but starting from a certain cell onto the rest of the row?
Something like =SUM(C5:~)?
A formula's cell range generally has two parts. A5:H5 contains the cells starting at A5 and includes all cells going across row 5 to H5. Similarly, A5:A9 contains the cells starting at A5 and includes all cells going down the column to A9.
You can use the INDEX function to determine the second part of the cell range reference.
'from A5 to the last number or date in row 5
=A5:INDEX(5:5, match(1e99, 5:5))
'from A5 to the last text in row 5
=A5:INDEX(5:5, match("zzz", 5:5))
'from A5 to the last number or date in column A
=A5:INDEX(A:A, match(1e99, A:A))
'from A5 to the last text in column A
=A5:INDEX(A:A, match("zzz", A:A))
To SUM from D5 to the last number in row 5,
=SUM(D5:INDEX(5:5, match(1e99, 5:5)))
This method is preferred when creating dynamic named ranged (with formulas as the Refers to:) over the OFFSET function as INDEX is non-volatile while OFFSET is volatile and will recalculate whenever anything in your workbook changes.
=SUM(C5:XFD5)
Tested and it works. The last column is XFD, so you're summing on everything right of C5.
This would work:
=SUM(5:5)-SUM(A5:B5)
as would
=SUM(C5:XFD5)
as XFD (16384) corresponds to the maximum number of columns.
try this:
=SUM(E3:E)enter image description here
so the result will be 6, as you starter from
certain cell.

Resources