I have a excel workbook where Sheet1 Cell A10 refers to the Sheet2 Cell A1.
I am using the formula
Sheet2!$A$1
I run an SSIS package, which has a script task that adds a column and a row to the Sheet2.
Now the formula automaticlly changes to
Sheet2!$B$2
Although I am using absolute formula, I dont get what I expected. Any ideas on how to achieve what I want?
Please try say =INDIRECT(A11) (adjust A11 to suit) instead of =Sheet2!$A$1 and in A11 (or wherever chosen) =ADDRESS(1,1,1,1,"Sheet2"). I think this should be what you want if I understand you correctly - ie you do not want to follow A1 around as rows/columns are added but literally the top left hand corner, regardless of column/row changes.
Related
I am looking to do a kind of automatic cell updates on excel, which is a status update for a product we got and the location of the product in the warehouse.
I have basic knowledge of VBA and I didn't manage to code anything to help me with that. I tried to use If function, but didn't make sense because I can't find a way to achieve what I need.
Here is sheet 1
and sheet 2
examples.
This is what I am trying to achieve:
if a cell within Sheet2 column A range = Cell A2 in sheet 1, then fill Sheet1, B2 cell and Sheet1, C2 cell with the information from sheet2 on the condition that it is the most recent entry (in the example images it is the entry with the dispatched status)
Would you recommend VBA or using formulas, and if so what should I do?
This can be done with formulas, however getting the latest value isn't as easy as it seems. This can be achieved however by following this tutorial for reference. I especially refer to the part using LOOKUP(.
Other than that, all you need to do is set your ranges to refer to the correct sheet.
=IFNA(LOOKUP(2,1/(Sheet2!A:A=Sheet1!A2),Sheet2!B:B),"")
My formula in B2 is:
=INDEX(Sheet2!$B:$B;MAX(SI(Sheet2!$A:$A=Sheet1!A2;ROW(Sheet2!$A:$A)-MIN(ROW(Sheet2!$A:$A))+1)))
My formula in C2 IS:
=INDEX(Sheet2!$C:$C;MAX(SI(Sheet2!$A:$A=Sheet1!A2;ROW(Sheet2!$A:$A)-MIN(ROW(Sheet2!$A:$A))+1)))
Both formulas are array formulas so instead of entering them with ENTER, they must be entered pressing
ENTER+CTRL+SHIFT at same time
Anyways, these formulas will probably make your file heavy and slower. Think about redesigning the way you save data, and consider adding a date field, and resuming data with Pivot Tables.
The title pretty much says it. I need to transfer certain cells from one cell to another without the coordinates of the cells changing after an insert operation.
In ex., I want the value of cell B3 of Sheet1 to transfer to cell A2 of Sheet2. If I insert a column on the left of B3, the previous B3 will become C3 and you now have a new B3 in which you can add a new value. I want my A2 to still receive the value of B3, but the new B3, not the old B3 with is now C3.
If I go with +Sheet1!B3, after the insertion of the column it will become +Sheet1!C3. I want it to remain to +Sheet1!B3.
I tried with $, +Sheet1!$B$3, but it still changes.
You can use the indirect function in excel.
+INDIRECT("Sheet1!B3")
With the caveat that you never change the location of column A you could do the following:
=INDEX(Sheet1!$A:$$ZZ,ROW(B3),2)
Caveat: as set up will only work for cells between and including columns A and ZZ. the ZZ reference will increase as columns get added. If you have columns outside of ZZ initially, then you will have to adjust the final column reference to suit your needs.
INDEX gave me some errors in the function (probably on my end), but I managed to solve it using INDIRECT.
Ty for the feedback, #AlexCollins #ForwardEd
My VLOOKUP command is like this for column-D, row-3 in Sheet1:
=VLOOKUP(Sheet1!C3, ABBREV!B2:BA8791, 2, FALSE)
I search for 'Sheet1!C3' in the first column of 'ABBREV!B2:BA8791', and if there is exact match I return with a value in column '2'.
Above works for the selected cell D3. But how to propagate this to more cells below it (~10000) quickly changing the formula only at C3? i.e. For D4 I only need C3 changed to C4 in the above formula. Dragging the corner of the cell doesn't work. Selecting all the cells I want to populate and entering ctrl+Enter changes the range in C3 as well as the ranges in ABBREV in the formula. Using ctrl+Shft+Enter doesn't change C3 to C4.
as pnuts said, you should use static address for your source table, change your code to
=VLOOKUP(Sheet1!C3, ABBREV!$B$2:$BA$8791, 2, FALSE)
when Excel copy formula, it will change addresses to make best representation to your needs, but changing the source table that you are looking into it will make error in some earlier lookups that you have change ABBREV!B2:BA8791 to ABBREV!$B$2:$BA$8791.
using ABBREV!B:BA not suggested as we don't know that in ABBREV sheet, you have just one table or more, and it can cause wrong results.
using $ before each ROWs or COLUMNs tells excel to don't change this ROW or COLUMN automatically. for example you can use $C3 in your code to tell excel to change 3 if row changes, but don't change C if column changes. of curse this is not necessary right now, and I used it as an example.
In Excel I want to copy a formula down and control the relative cell reference.
For example
In A1 if the formula was =B1 and I copied the A1 formula down to A3 the formula in A3 would be =B3. Is there a way of copying the formula in A1 to A3 and have it equal B2?
That's the default copying behaviour in Excel. Did you try it? In fact, if you want to disable it, you have to write $ in front of the fixed row and/or column denominator, so for example $E$1 would be fixed when copied (useful for things that remain constant).
Edit: I think I can imagine what happens: You probably tried to copy the cell contents from the formula editor field. Copy the cell instead, so just mark the cell in the grid by highlighting it, copy it, highlight your target and paste.
Edit2: And please note that you can just drag the little square at the edge of a highlighted cell to apply that cell's formula to an entire area, using the same relative referencing as with copying.
quick excel question:
If I put values in cell B1 and B2.
Then write the following formula in cell A1:
=$B$1-$B$2
then I highlight cells B1 and B2 and move them to column C. the formula in A1 automatically adjusts for the move ie. formula now becomes:
=$C$1-$C$2
How would I get it to stick to column B and not switch to column C. I tried searching google but did not get right answers (probably am not phrasing question correctly).
The context of my problem is that formulas in one sheet are being calculated based on month end data which is placed in another sheet. Now I need to add April month end data. So I shift the old data to the right and input April's data, but the formulas are automatically adjusting for the shift and still refer to March's month-end data. This despite the formulas using absolute referencing.
Thanks for any help provided
The formula you are looking for is
=INDIRECT("B1")-INDIRECT("B2")
This will always refer to Cells B1 and B2 regardless of what you to do move the cells or add new columns etc.
This will allow you to simply insert a column for the new month.
Not a good spreadsheet design, you should really add new data to a new column.
However, if you are determined to stick to that design, copy and paste the old values to a new column, then delete the originals. Formulas will not be alterd by that.