Update cell location in excel - excel

I wanted to get the cell from one sheet based on cell value in other sheet
eg.
2 sheets : x,y
I want cell value from sheet "y" and its cell is "A" and column value of "A" depend on sheet x and cell B1
eg. y!A(x!$B1+1)
However,y!A gets evaluated first and I get error.
Can anyone suggest solution ?

This formula should do it:
=INDIRECT("y!r1c"&x!B1, FALSE)
This assumes x!B1 holds the column as a number

y!A(x!$B1+1)
You can use INDIRECT like Dave mentioned
y is the Sheet
A is the column
(x!$B1+1) is the row
However since you want to pickup the row part and not the column part, Dave's formula needs to be written as
=INDIRECT("y!r"&(x!B1+1)&"c1", FALSE)
Alternatively you can use OFFSET
=OFFSET(y!A1,x!B1,0)
No need to Add +1 Offset will take care of that.

Related

How can i pass specific values from one sheet to another sheet based on specific criterias

I have an Excel Workbook with two Sheets. In one sheet I have these values:
and in the second sheet i have this values:
What I want is that in the Sheet2 the cell E to have values of Prognose from Sheet1 where "Motor" of module_team and "OM470" of series gives values based on Datum_produktion in the Sheet2.
The formula that I have tried till now is this but it doesn't seem to give me the values that I need.
=IF(Tabelle1!B2="Motor";VLOOKUP(A2;Tabelle1!$F:$H;2;FALSE);VLOOKUP(A2;Tabelle1!$F:$H;2;FALSE))
I also tried this formula but it gives me the #NUM! value.
=INDEX(Tabelle1!$G:$G; AGGREGATE(15; 7; ROW($2:$500)/((Tabelle1!$D$1:$D$500=E$1)*(Tabelle1!$F$1:$F$500=$A2)*(Tabelle1!$B$1:$B$500="Motor")); 1))
I adjusted the Settings in the Calculation part by checking the Enable Iterative but still it doesnt work.
An exmaple how should look in the Motor under OM470 sheet.
Your help is much appreciated!
You may use SUMPRODUCT to solve your issue:
=SUMPRODUCT((Nr_module_team=100)*(series="OM470")*(Datum_Produktion=I2)*Prognose)
I have used a few named ranges in my formula:
Nr_module_team: Column A on your Sheet1;
series: Column D on your Sheet1;
Datum_Produktion: Column F on your Sheet1;
Prognose: Column G on your Sheet1,
You can replace these named ranges with actual cell references.
Cheers :)
This line:
=IF(Tabelle1!B2="Motor";VLOOKUP(A2;Tabelle1!$F:$H;2;FALSE);VLOOKUP(A2;Tabelle1!$F:$H;2;FALSE))
checks if B2 = 'Motor' in Sheet 1
if so, it looks up the date in Col A (Sheet 2) and returns the value from Sheet 1 in the row matching the Col A value
if not, it does exactly the same thing.
If you want 0 or null (I'll assume 0) in the cells where the value in Sheet1!B2 is not 'Motor', change your lookup formula to:
=IF(Tabelle1!B2="Motor";VLOOKUP(A2;Tabelle1!$F:$H;2;FALSE);0)
Change the '0' to "" if you want an empty cell.
Based on your comment (you want the figure when the value in Col B = 'Motor' and the value in Col D = 'OM473') change the formula to:
=IF(AND(Tabelle1!B2="Motor", Tabelle1!D2="OM473"); VLOOKUP(A2; Tabelle1!$F:$H; 2; FALSE); 0)

Return a value from another column and sheet using MATCH

I have a worksheet where I need to fill in data referenced from other worksheets.
I need to match a value on my main sheet with one on another sheet and once the cell has been found I need to get the value of a different cell offset by 1 row up and 5 columns left. I know which columns I need but I need MATCH to return the initial row.
MATCH will give me the initial row that I need.
ADDRESS means I can build the cell reference.
OFFSET allows me to reference another cell if I have the original cell address.
However the ADDRESS function will only return the address as a text string and not as a reference that can be used in the OFFSET formula.
Does anyone know of a way to make this work?
Kind regards
Matt
If the value on your main sheet is in cell Sheet1!A1, and the matching value is somewhere in column Sheet2!J:J.
The MATCH formula will return the row number:
=MATCH($A$1,Sheet2!$J:$J,0)
You want one row up from this so the formula will be:
=MATCH($A$1,Sheet2!$J:$J,0)-1
Make sure this does not fall below 1
To return a reference to another cell you'd use INDEX as this is non-volatile and won't try and recalculate unless you change a figure it uses.
It returns a reference to a cell given a range of cells, a row number and a column number.
Your column is always five columns to the left, so if you're matching in column J you want a figure from column E.
e.g. If you want row 5 from column E you'd use =INDEX($E:$E,5).
Replace the row number with your Match formula and you get the figure you're after:
=INDEX($E:$E,MATCH($A$1,Sheet2!$J:$J,0)-1)

Excel: count values on another sheet with dynamic column reference

I have a simple formula in cell B7 of a sheet called Summary Stats that references a sheet called Rolling Returns Data:
=COUNT('Rolling Returns Data'!C$11:C$17202)
I want to be able to dynamically reference the column in the formula i.e. I have letter C in cell B1 of the Summary Stats sheet and want to be able to replace the reference to column C in the formula with a reference to cell B1, so that if I then change the formula that calc. that is then being performed is:
=COUNT('Rolling Returns Data'!D$11:D$17202)
As Scott Craner suggested, use INDIRECT.
=COUNT(INDIRECT("'Rolling Returns Data'!"&A1&"$11:"&A1&"$17202"))
Now you just have to put the letter of the column you want to reference. You can of course change the A1 reference to anything you'd like. Or you can change the code to the following
=COUNT(INDIRECT("'Rolling Returns Data'!"&A1))
and use A1 to specify the address of your column, in this case "C$11:C$17202".
If you're ok using column numbers rather than column letters then this non-volatile formula will work:
=COUNT(INDEX('Rolling Returns Data'!1:17202,11,$B$1):INDEX('Rolling Returns Data'!1:17202,17202,$B$1))
If you really want to use column letters then you can turn a column letter into a column number using:
=COLUMN(INDIRECT($B$1 & 1))
But then you lose the non-volatile nature.
Edit:
If you use the column numbers and leave B1 blank it will return the count of all columns.

How do I automatically update cells to match values from another sheet when one cell is changed using data validation?

I have a list of items on Sheet 1 with the names of each item in column A and then further information in the subsequent 5 columns.
On Sheet 2, in each of the cells of column A, I have set it so that I can pick any item from a dropdown list using data validation. I want the subsequent cells in the row to automatically assume the value of the respective cells in Sheet 1.
So if in Sheet 2, Cell A1 I select Item 3 (which is in Cell A3 on Sheet one), I want Cell B1 on Sheet 2 to have the same value as Cell B3 on Sheet 1.
I could get the result I wanted by using =IF($A3='Sheet1'!A3,'Sheet1'!B3,) and then adding each possible item but that seems really long winded and would require adding to the formula every time I added an item.
Any idea if there is a way of doing this? Sorry if my explanation is a bit confusing. My excel knowledge is not great!!
Thanks in advance
Use the Vlookup function
Next to your data validation cell, enter (assuming the first sheet called Sheet1):
=Vlookup(a1,Sheet1!a:f,2,0)
This will return the data that match for the 2nd column. For the 3rd use:
=Vlookup(a1,Sheet1!a:f,3,0)
And so on..

Excel: Find intersection of a row and a column

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.

Resources