Excel Formula Referencing - excel-formula

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.

Related

If a cell in column A in sheet 2 equal to a value from sheet 1 then return the values from sheet 2 to column B and c in sheet 1

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.

Transferring certain cells from one sheet to another in excel despite column/row insertion/extraction

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

Auto +6 increment while dragging cells in excel

So, I got an excel with two sheets: Sheet1 and Sheet2, in which I transfer data from the first to the second using the formula: =IF(INT(+INDIRECT("Sheet1!A1"))< 42900,0,+INDIRECT("Sheet2!A1")) (the cells are custom format dd/mm/yyyy hh/mm/ss). In Sheet1, the cells are organized in groups made out of 6 columns (in this example, A being the first column within the group).
In Sheet2, when I drag the cell containing said formula to the cell on the right, the formula remains the same. I want so that when I drag the cell, A1 will become G1, basically incrementing the column "number" by 6 jumping to the next group of 6 columns.
Is there a way of doing this WITHOUT using any coding. I need to avoid coding at all costs in order to avoid further complications.
P.S. I apologize if my explanation and title are somewhat vague.
Enter below formula anywhere in Column 1 and drag/copy across (to right)
=IF(INT(INDIRECT("Sheet1!" & ADDRESS(1,FLOOR((COLUMN()-1)*6,1)+1)))< 42900,0,INDIRECT("Sheet1!" & ADDRESS(1,FLOOR((COLUMN()-1)*6,1)+1)))
This formula will refer to cells $A$1,$G$1,$M$1,$S$1,.....
If you have to use this formula in say Column B then change (COLUMN()-1) to (COLUMN()-2) and likewise for Column C,D,E,.... use (COLUMN()-3),(COLUMN()-4),(COLUMN()-5),.... respectively.

Excel Formula Column Manipulation

I need to change the value of a column in a formula but I need to do this programmatically rather then manually due to the number of cells I will have this in.
I am copying this formula into hundreds of cells - ='April16-March17'!L30
When I copy it into the first cell all is good but copying to the next cell (2 columns away) gives me ='April16-March17'!N30 but it should be ='April16-March17'!M30
Therefore is there a way to change the master formula to display one column reference down from where it thinks it should be?
='April16-March17'(ColumnValueChange(!L30-1) for instance.
Is that clear?
Thanks
Paul

Row Number In Formula Not Counting When I Drag

I have the formula below that I'm using to link to a certain sheet and cell in my workbook that contains a graph for each entry. On the sheet I link too, each graph is about 20 cells down from the previous one. I have over a 100 graphs now and it will grow in time so I was trying to use the HYPERLINK formula rather than the Hyperlink button for this. I thought I would be able to just insert the formula in the first row, paste it in the second row with an added 20 cells, highlight the two and drag it down but it will not count in increments of 20.
Is this even possible?
=HYPERLINK("#'Trends'!A25","Click To View Trend")
I'm thinking you will have to use some type of concatenation to get the behavior you are after. To do this, you may want to employ a "helper" column. For example, put the "numbers" you are after in column B -- below you will see that I incremented it by 5.
Now your HYPERLINK formula in cell A1 is written as:
=HYPERLINK("[Book1]Sheet2!A"& B1,"Click Me for Sheet2, Cell A"&B1)
(Assuming the workbook is called Book1. Now, I can drag that formula down and it will update "dynamically" to account for the changes in column B.

Resources