Excel bug: Formula moves when referencing other worksheets - excel

Many times when I'm creating formulas (and it seems to happen more often when they are more complex formulas) the location of the formula moves to the sheet I'm referencing. For simplicity, if I'm in A1 on Sheet1 and I type "=" then select Sheet2 and click on M13 such that the formula then reads "=Sheet2!M13, when I hit return, that formula will show up in cell A1 of Sheet2 instead of Sheet1.
I can't seem to figure out what I'm doing in those instances that creates this issue. Any help would be appreciated.

It is possible to create the behavior that you are seeing.
If you happen to hold down the Ctrl key during Sheet selection, then both Sheets 1 & 2 may become Selected (as a group).
If this is the case, then it is possible for the formula to get deposited in cell A1 in both Sheets !

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.

Is there a formula or method of automatically Multiplying Data on a particular sheet and across diffterent sheets

I am creating a report document which will automatically calculate the total marks earned by a student in a classroom. The values to be multiplied are in cell B22 and E22 of Sheet1, Sheet2, Sheet3 and to display the result in Sheet4. Sheet1, Sheet2 and Sheet 3 have the same formatting and design. What is the method or Formula that can be used to multiply;
B22*E22 in Sheet1 which will display the result in sheet4,
and when i use the auto fill handle on the cell containing the result in sheet4, excel should follow that pattern to multiply the same cells across the various sheets automatically;
let's say
B22*E22 in Sheet2
B22*E22 in Sheet3
and so on...
I have tried calculating it manually;
Let's say on Sheet4 in Cell A1, i used
='Sheet1'!B22*'Sheet1'!E22
in Cell A2, ='Sheet2'!B22*'Sheet2'!E22
in Cell A3, ='Sheet3'!B22*'Sheet3'!E22
and it worked. But the problem here is that, this work is purely manual and time consuming since i have a lot of sheets (about 62 sheets) and a lot of other cell calculations to make similar to that above (in other workbooks).
When i input the formula ='Sheet1'!B22*'Sheet1'!E22 in cell A1,
i tried using the auto fill handle to drag and fill the cells A2 and A3.
But it didn't work as excel keeps changing the cell references.
This is the formula i used which works on Sheet4
in A1 ='Sheet1'!B22*'Sheet1'!E22
When i use the auto fill handle, to fill the formula and have the values in
A2, this is what it gives ='Sheet1'!B23*'Sheet1'!E23
A3, this gives ='Sheet1'!B24*'Sheet1'!E24
I want a formula or method through which when i use the field handle, excel should Maintain the Cells reference for calculation (Multiplication), that is,
B22 and E22
and rather change the sheets instead. That is,
On Sheet4, in cell A1: ='Sheet1'!B22*'Sheet1'!E22
A2: ='Sheet2'!B22*'Sheet2'!E22
A3: ='Sheet3'!B22*'Sheet3'!E22.
The formulae above is the result i expect to have.
But the actual output is
On Sheet4, in cell
A1: ='Sheet1'!B22*'Sheet1'!E22
A2: ='Sheet1'!B23*'Sheet1'!E23
A3: ='Sheet1'!B24*'Sheet1'!E24.
Any help/clue will be highly appreciated!
Thanks in advance.!
=INDIRECT("'Sheet"&ROW(A1)&"'!B22")*INDIRECT("'Sheet"&ROW(A1)&"'!E22")
Place the above formula in an empty cell then copy down.
The INDIRECT function converts text with references to an excel reference. Something to be aware of though is that INDIRECT is a volatile function. This is not the end of the world. A volatile function simply means it recalculates anytime anything in the workbook changes. A regular function will only recalculate when something that affects it changes. In other words, if you have a workbook full of volatile functions you may notice some performance issues with the workbook due to all the calculation happening anytime a cell was changed
Update
Apparently I should listen to my own write up. INDIRECT converts references. Apparently it will not work with the math operator. So use indirect for each reference and keep your math operators out of the indirect.
The above image shows a copy and paste of the above formula. IF the sheet does not exist it will toss an error as it does not have an address to find.
So lots of options shown working, B22 left blank to prove calculation works.
Used multiply instead of add as that was what you had, also changed "" to 0 to get the correct functionality.

Can I use one formula for several sheets?

I have a workbook that currently have 20 sheets and it grows with about 3 sheets per day.
All sheets use the same formulas in columns H-L.
But sometimes I find errors in the formulas or need to ad a condition to it and then I need to update all sheets formulas with the same formula. And that is the problem.
Can I have the formula in one cell somewhere and in each column just reference to this formula so that if I change the formula in this cell it will change in all places?
In each sheet I need the formula to "fill down" about 2300 rows.
In sheet1
A1
=A1+B1
In sheet2
A1
='sheet1'!A1 // will calculate A1+B1
Anyone know of a way to do this?
If all sheets have the same structure, you can use a 3D selection to change a formula in the same cell on all sheets.
For example, if your workbook has sheets 1 to 10, select cell B1 in Sheet1, then hold down the Shift key and click Sheet10. Now all cells B1 in all sheets from Sheet1 to Sheet10 are selected, no matter what the sheet name is.
Enter a formula like =A1+A2 and hit Enter. Click any sheet and check the result. B1 will have that formula in each of the sheets.
Now go back to Sheet1, select B1, hold Shift and click Sheet10. Change the formula to =A1*A2 (multiply instead of add) and hit Enter. Copy the formula down.
Check the other sheets and see that the same formula has been applied and copied down on all other sheets.
With this technique, you can select the same cell in all sheets of the workbook and change the formula in all sheets with just one edit. Of course, it only works if all sheets in the selection have the same data structure.
Edit after comment: You could use the first sheet as the Formula Master sheet, and just need to remember that if you want to change a formula, you first have to use a 3D selection. Other than that, Excel does not offer formula replication in the way you describe. A reference to a cell will always return the cell's value, not its formula.
You could create a UDF (user defined function) in VBA for your goal:
Press Alt+F11, right click on your project in the project explorer and select Insert --> Module. Paste the code below:
Function ExecuteFormula(ByVal Target As Range)
On Error Resume Next
ExecuteFormula = Evaluate(Target.Formula)
End Function
Now you can use the ExecuteFormula() like every other function. If you want to enter the formula in your master sheet as a string "=A1+B1" just replace the 3rd line with:
ExecuteFormula = Evaluate(Target.Value)
I hope this helps.

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.

How to Make One Cell equal different cell values on multiple sheets and locations

I'm working in Excel 2010, and my question is how do I make a cell (say on one sheet to equal a specific value placed on another sheet). I thought the following formula would do it but it doesn't work.
=IF(COUNTIF(Name,$A2)=1,VLOOKUP($A2,Name,2,FALSE),''))
If I understand your question, you simply want one cell to represent the value of another cell from another sheet? If so, the formula will look like this: =[name of sheet]![cell reference] EG: =sheet2!A1
If used in cell A1 on sheet 1, this would put the value of cell A1 from sheet2 into A1 of sheet 1.
If you modify your question so that you reference the actual sheets & cells you're interested in, I can help you with the formula.
You can easily facilitate this by writing your formula in the bar, then when you need to reference a cell on a different sheet, simply navigate to the sheet & cell to insert it's address into the formula, then carry on with your formula if necessary.

Resources