I need a way to reference Cell A1 in Cells C1:C16, then B2 in Cells C17:C32, and so on for a few thousand rows, so manual data entry would be very tedious. I am able to get the proper row to reference using the fomula:
=ROUNDDOWN(1+(ROW()-1)/16,0)
This formula produces the number 1 for rows 1:16, the number 2 for rows 17:32 etc.
But once I have that row number, I am not sure how I can reference the contents of column A in the row determined by a formula.
I was trying something like:
=$A(ROUNDDOWN(1+(ROW()-1)/16,0))
so that once the formula is evaluated, it becomes $A# where # is the intended row number, but obviously that is not syntax that excel recognizes. Any ideas on how to go about getting the correct cell references would be appreciated.
The same answered through Comment by #chris neilsen and the same accepted by #User247365
Here your go for an answer!
Feed the calculated row into
=INDEX($A:$A, row, 1)
Related
How do I find either the cell address or preferably the row and column of the value 119, or any other number in the table below?
The table does not contain row or column titles, only the numbers as shown.
I am looking for a worksheet solution (formula) and not a VBA solution.
An Array Formula
This is an array formula and it has to be entered with control shift enter i.e. hold control shift and then press enter.
=MAX(IF(A1:J34=119,ROW(A1:J34)-ROW(A1)+1))
Remarks:
The value is searched by column i.e. A1, A2, ... B1, B2 ... i.e. if you had another 119 in cell D1 the result would still be 2, and if you had a 119 in cell c1 then the result would be
1.
For a column version just replace ROW with COLUMN:
=MAX(IF(A1:J34=119,COLUMN(A1:J34)-COLUMN(A1)+1))
Well, clunky and you can expand it, but it does work:
Row is separate to column but you could put them together in one cell, does depend on how you want to use the results, but you did not specify that so I have done this...
You could use a choose() function or a lookup table with vlookup() to change the column result to a letter...
Please try:
=MOD((K1-50),34)+1&" | "&1+(INT((K1-50)/34))
where K1 is your selected value.
Returns R | C. (Data in A1:J34 is not required.)
Below is a general purpose answer based on VBasic2008's answer.
I modified the formulas to utilize defined names so that the cell references do not have to be hard coded in the formulas. This way both the data table and row / column formulas can be relocated to anywhere on the spreadsheet. It works for both numerical AND text based data.
I also included the =ADDRESS() function to return the absolute reference of the look up value.
For illustration purposes, a step by step example for Data Set 1 is shown replacing the hard coded cell references with defined names.
The Data Set 2 section is the simplified version just using one defined for each the row and column look up value.
You can download an example spreadsheet here: Look_Up_a_Value_in_a_Table.xls
Thanks to all of you: Solar Mike, VBasic2008, and pnuts
Click on the image to enlarge.
My question is related to a question asked earlier, but as I am a new member I was not able to comment on that question.
The earlier question asked how we can dedupe a list in a workbook to create a new list of unique values on another sheet in the same workbook. The top voted solution given by #achaudhr works for me but in that I need to specify the exact cells the formula needs to reference. In the comments on that answer #Dan has mentioned that we must use OFFSET if we are referring to a dynamic range.
This is the formula I am using at the moment:
B2=INDEX($A$2:$A$20, MATCH(0, COUNTIF($B$1:B1, $A$2:$A$20), 0))
I have tried using offset with this formula but I guess I am doing something wrong because it keeps giving me #N/A as a result.
If my data was in column A (as per the above formula), I want to be able to change the ":$A$20" part of the range dynamically. The list in column A changes as per an input I put in the workbook on another sheet (let's call it Sheet 3). Hence I cannot hardcode the cells in the index formula range or else I have to change this range every time my list updates.
Based on the above layout, the cell in E2 calculates the max cell number for the list in column A on sheet 1. This number changes when the input in Sheet 3 changes.
I edited the above formula to use OFFSET to reference E2 in the following way:
B2=INDEX(OFFSET('Sheet 1'!$A$1,'Sheet 1'!$E$2,0), MATCH(0, COUNTIF($B$1:B1, OFFSET('Sheet 1'!$A$1,'Sheet 1'!$E$2,0)), 0))
This formula is returning #N/A (and I did press Ctrl + Shift + Enter so its not because of that).
I hope the group here can help me solve this. Look forward to the inputs and thanks for all your help.
Thanks,
Neha
The way to use OFFSET in a dynamic range determining formula, where it is column length that varies, is to use that value as the [height] parameter.
So, in the case of your example, the formula would look like:
B2: =IFERROR(INDEX(OFFSET($A$1,1,0,$E$2-1), MATCH(0, COUNTIF($B$1:B1, OFFSET($A$1,1,0,$E$2-1)), 0)),"")
Reference: $A$1 (could also set this at $A$2 with a 0 Row offset
Row Offset: 1 (since A1 contains the header)
Column Offset: 0
[height]: Contents of $E$2 minus 1 (since we are not including the header in the list)
[width]: left blank
I'm working on a spreadsheet and trying to create a formula to count the last cell with data, then return the column heading for that cell.
There are two parts here:
Find the first cell with data, return the column heading
Find the last cell with data, return the column heading
I've solved for 1 by the following:
=INDIRECT(ADDRESS(1,COLUMN((INDEX(H223:S223,MATCH(TRUE,INDEX((H223:S223<>0),0),0))))))
But I haven't been able to solve for the second part. I found the following solutions online, but they aren't quite right...
=(ADDRESS(ROW(H223:S223)+ROWS(H223:S223)-1,COLUMN(H223:S223)+COLUMNS(H223:S223)-1))
^ Returns the last cell reference of the range, does not check if cell has data or not.
=LOOKUP(2,1/(H228:S228<>""),H228:S228)
^This one is a bit more promising. This formula returns the value of the last cell with data in the range. But I can't get LOOKUP to work with INDIRECT/ADDRESS/COLUMN functions which I used for the first formula.
Can anyone help me out? Thanks!
FYI - the column headings are months and cells are $ projections. These formulas are supposed to help me understand how $ flows by month for the next fiscal year.
=LOOKUP(2,1/(H228:S228<>""), H228:S228)
' ^^^^^^^^^^
Your LOOKUP formula is a good idea, but needs a slight modification to return a value from the header row instead of the investigated row:
=LOOKUP(2,1/(H228:S228<>""), H1:S1)
' ^^^^^^
To return the column header of the last cell with value, use the following:
=IFERROR(INDEX(H1:S1,MAX(IF(LOOKUP(2,1/(H228:S228<>""),H228:S228)=H228:S228,COLUMN(H228:S228),0))),"")
Array Formula press Ctrl+Shift+Enter at the same time
Array formula in case you have duplicates
H1:S1 is the Header Row
H228:S228 the last row with data
Lookup will find the last cell with data
Index will return the corresponding header
I am currently making a spreadsheet which has information relating to properties, One of the columns lists the source for the property such as Zoopla, Rightmove, Fish4. I need a formula that will scan the entire Sources Column for 1 word and add a value to a cell that shows the total number of Sourced information from that source. I have been trying for sometime and cannot figure out the formula.
Rightmove Total = 3
Zoopla Total = 4
Any information is appreciated
try this:
=SUM(IF((A1:A5="Saint"),1,0))
if the searched string is found, assign 1 to each true condition. then add up the results and there you go!
Note: please change the column numbers and search string, as this is just an example
If I'm understanding your problem properly, what you need is the COUNTIF() function.
=COUNTIF(Sheet1!A:A, Sheet2!A2)
Will count the number of occurrences of the value within cell A2 of Sheet2, into column A:A of Sheet1.
So, if Sheet2!A2 has Rightmove and Rightmove appears three times in Sheet1!A:A, then the formula will return 3.
In Excel, the Offset function returns a reference to a range that is offset a number of rows and columns from another range or cell.
can someone please tell me what that means?
for example in this formula:
=OFFSET($B$4,ROW()-ROW($F$4),0,1,1)
what is it doing?
The purpose of OFFSET(BASE, ROW-OFFSET, COLUMN-OFFSET, NUM-ROWS, NUM-COLUMNS) is to select the content of cells that are NUM-ROWS rows and NUM-COLUMS distant from the base cell. If the selected cells are just one, then the content of that cell will be used as result, otherwise the result will be an array that can be passed to functions as SUM.
In your example, the function is simply selecting the content of the cell B4.
That example formula is odd, because it references a cell to get the row then takes that away from the current row - this bit ROW()-ROW($F$4, which might as well be row()-4, but there you go.
Offset, works like this
A cell location to start at, how many rows away from this, cols away from the this, optional size(rows), optional size(cols).