How to create "lock" (stop updating of cells) in Excel? - excel

My question is pretty simple, but one to which I can't really find a solution myself. I use Excel quite frequently, but rarely the fancy stuff. Anyway, to the point:
How do I create a dropmenu that will lock certain cells, rows or columns?
(by lock I mean unable to change via hand and stops updating itself).
Example: A1 = 5, B1 = A1 * 100, C1 = A1 * 100
Can I "lock" the B1-cell, so that changing A1 will have no effect on B1 (Will remain at value 500), but will normally affect C1-cell (will update and calculate new value)?
I would preferably want to be able to "unlock" the cell as well, instead of simply making function into value.
Is this possible?
Thanks in advance!

You would need to programmatically store the formula from B1 somewhere as text, then convert B1 to Value (use copy-paste value or similar). To unlock the cell copy the formula back to the cell.

Maybe just change the "Workbook Calculation" setting (in Excel 2007, it's under Office Button > Excel Options > Formulas) from Automatic to Manual? What'll happen then is that B1 (or any other formula) won't update unless you hit F9 (or use the equivalent command) to do so.

copy value of B1 and paste value only, record this sequence as macro and assign a button. Run this macro when required

Related

How to reference every cell of another tab using indirect

I want to create a tab that will display all the cell values of another tab based on the tab name provided on a cell.
I have played around with the indirect function, but I cannot write a formula so that by dragging down and right it will access the cells.
=INDIRECT("'"&$A$1&"'!A1")
This part &$A$1& is getting the name of the tab.
If I drag down this formula, the last A1 does not change though.
You can use the formula ="Sheet2!A1" in Sheet1 Cell A1 and drag down, then across. I tried to find a faster way to paste it into every cell, but I had to force quit the application because it used all of my available memory. You might think about whether you actually need every cell to be duplicated into the second sheet. Good luck!
Edit: Just realized you were dead set on using Indirect. This should work.
=INDIRECT("'Sheet2'!"&CELL("address",A1))
Simply use following formula
=INDIRECT($A$1&"!A" & ROW(1:1))
Try building the string like this. The final A1 will work as you want it to.
=INDIRECT(CONCATENATE("'",$A$1,"'!", CELL("address",A1)))

I am trying to make a spreadsheet on Excel that will work out the average of an input in the same cell

Hi i have a spreadsheet to calculate the averages of my players in Fifa game to game. I need a to be able to input a number to a cell and it will calculate the average of that input and the past inputs in that cell.
If you want to avoid VBA, you can achieve this using circular references. The following solution works with the following scenario:
You're putting the data in cell A2 (you can change this)
You're never putting in a value of 0
You're never putting in the same value twice in a row
The average will be displayed in B2 (you can change this)
You only need to store 20 values (you can extend this)
The history is stored in C2:C21 (you can extend this)
(If you are putting in the same value twice in row, you can't even achieve this using VBA easily without also adding a button that needs to be pressed manually every time, because VBA needs to see a change in value to know when it's been updated.)
To set this up, follow these steps:
Ensure cell A2 is empty before you start
Go to File > Options > Formulas and put a tick against Enable Iterative Calculation at the top right (this allows circular references)
Put this formula into B2: =AVERAGEIF(C2:C21,">0")
Put a heading into C1, such as "History"
Put this formula into C2: =IF($A$2=0,0,IF(AND(C2=0,C1<>0,C1<>$A$2),$A$2,C2))
Fill the formula down to C21
You can now start entering values into A2 and each new value will be added to the list automatically.
To reset the list, put 0 into A2

Excel doesn't update value unless I hit Enter

I have a very annoying problem in one of my worksheets in a workbook. I am using EXCEL 2007. Any cell's value will not be updated unless I hit ENTER. Either if the formula in the cell includes an if condition, or a VLOOKUP function or even an AVERAGE function. All the calculations are set to automatic, Application.Calculation = xlAutomatic, and even the calculations for the specific worksheet are enabled, like : ws.EnableCalculation = TRUE.
Furthermore, the ScreenUpdating is set to TRUE. After I hit the ENTER or I drag down the right corner, the cells will be updated, and they will keep being updated if I make any change. However, after saving the file and reopening it again they will be frozen again. I haven't figured out exactly when they will stop being updated again. All the formatting are set to General or number.
Especially in IF conditions, when I check the calculations through the evaluate feature, the result is correct but it is not passed on the screen.
Any suggestion? This thing is driving me crazy.
Executive summary / TL;DR:
Try doing a find & replace of "=" with "=". Yes, replace the equals sign with itself. For my scenario, it forced everything to update.
Background:
I frequently make formulas across multiple columns then concatenate them together. After doing such, I'll copy & paste them as values to extract my created formula. After this process, they're typically stuck displaying a formula, and not displaying a value, unless I enter the cell and press Enter. Pressing F2 & Enter repeatedly is not fun.
It sounds like your workbook got set to Manual Calculation. You can change this to Automatic by going to Formulas > Calculation > Calculation Options > Automatic.
Manual calculation can be useful to reduce computational load and improve responsiveness in workbooks with large amounts of formulas. The idea is that you can look at data and make changes, then choose when you want to make your computer go through the effort of calculation.
Found the problem and couldn't find the solution until tried this.
Open Visual Basic from Developer tab (OR right-click at any sheet
and click 'View code')
At upper left panel, select 'ThisWorkbook'
At lower left panel, find 'ForceFullCalculation' attribute
Change it from 'False' to 'True' and save it
I'm not sure if this has any side-effect, but it is work for me now.
This doesn't sound intuitive but select the column you're having the issue with and use "text to column" and just press finish. This is the suggested answer from Excel help as well. For some reason in converts text to numbers.
I have the same problem with that guy here: mrexcel.com/forum/excel-questions/318115-enablecalculation.html Application.CalculateFull sold my problem. However I am afraid if this will happen again. I will try not to use EnableCalculation again.
Select all the data and use the option "Text to Columns", that will allow your data for Applying Number Formatting
ERIK
I Encounter this problem before. I suspect that is some of ur cells are link towards other sheet, which the other sheets is returning #NAME? which ends up the current sheets is not working on calculation.
Try solve ur other sheets that is linked
I ran into this exact problem too. In my case, adding parenthesis around any internal functions (to get them to evaluate first) seemed to do the trick:
Changed
=SUM(A1, SUBSTITUTE(A2,"x","3",1), A3)
to
=SUM(A1, (SUBSTITUTE(A2,"x","3",1)), A3)
Found a simple solution.
Let's say once cell A1 is changed, so you expect cell B1 change the color by conditional formula.
Make the problematic cell - B1 has a formula with dependency to cell - A1
So, for example instead of my cell B1 just have text value "Text", i'll change it to formula like:
=IF(A1>0,"Text","Text") - means: if A1 > 0, then insert value "Text" to B1
The result is - each time cell A1 is recalculated, it forces also cell B1 color to be updated.

Prevent cell from being calculated

Is it possible to prevent calculations happening to a single cell in Excel sheet? Let's say I have 1001 cells that are very fast to calculate, but 1 cell slows sheet down, is it possible to disable calculations for that 1 cell only?
What I'm NOT trying to do:
Disabling all of cell calculation programically
Calculating specific cells programically while global calculation is set to manual
Use Excel's =IF() function. It is set up to "short-circuit" -- it only evaluates the second parameter if the first parameter is true, oppositely for the third parameter.
So, if the cell is C1, and the cell's formula is currently
=LOOKUP(2,1/(A1:A100000=666),B1:B100000)
and you want it to only be calculated when D1 is true, use
=IF(D1,LOOKUP(2,1/(A1:A100000=666),B1:B100000),C1)
Notice it's a circular reference -- it's how you keep the value the same when D1 is false. Turn on iteration if you want to get rid of the warning message.
Another way is to use one of the third-party Add-Ins out there that lets you store a global variable off-sheet and then retrieve it, which would use syntax like this:
=IF(D1,SetGlobal("C1StoredCalculation",LOOKUP(2,1/(A1:A100000=666),B1:B100000)),GetGlobal("C1StoredCalculation"))
SetGlobal() and GetGlobal() can also be written in VBA, though they'll be a tiny bit slower than an XLL, and they'll lose the value if you reset your VBA project.
Excel does not have a method to disable calculation for a single cell.
You could move the slow formula to a separate sheet and use worksheet.enablecalculation to disable calculation for that sheet.
Or you could store the formula somewhere as text, store the result as a value in the cell, then restore the formula when you want to calculate it.
You can use a replacement UDF and take advantage of a lack of volatility.
Say we have a formula like:
=LOOKUP(2,1/(A1:A100000=666),B1:B100000)
Excel will re-calculate this if any cell in cols A or B change, but the UDF
Public Function myudf(r As Range) As Variant
myudf = Evaluate("LOOKUP(2,1/(A1:A100000=666),B1:B100000)")
End Function
will only be re-calculated when its argument changes. So pick a cell and enter:
=myudf(Z100)
make any changes you want to cells in cols A or B and myudf will remain un-re-calculated until you change Z100
You can use the same tiny trick to make "quasi-volatile" versions of =TODAY() or =NOW() for =RAND()
I don't think this can be done. You can turn off automatic calculation in entire workbooks (as you mentioned), but I don't think there is a way to do this on an individual cell.

How to avoid manually entering this formula in Excel

I'm trying to calculate a value called, "additional throughput". It is calculated by subtracting the base case module's throughput from a new module's throughput.
In the sheet below you can see that for the third row down (has a blue box in it), that the additional throughput is calculated by the formula "=T6-T4".
The problem is that when I click on this box and drag it down to apply the same formula to the other rows, I want the formula to become "=T7-T4" for the next row. Instead it becomes "=T7-T5". I tried to select multiple cells (where the formula was manually entered) before dragging down so it could recognize that the T4 doesn't change, only the first part. However, that didn't work.
In Excel you can use $ signs before the column or row references to make those references "absolute" (rather than "relative"). For example if you use =A$1 then the 1 doesn't change when you copy down. If you use =$A1 then the A doesn't change when you copy across. If you use =$A$1 then neither changes whichever way you go.
So for your case you need to use
=T6-T$4
when you copy that down T$4 doesn't change
You have to make the cell address of T4absolute by pressing F4, so it becomes $T$4. When you then copy the formular to other places T4 will keep its absolute address.
I figured it out.
You put a $ symbol in front of the row and column you want to not change. This is referred to as an absolute reference.
Found out how to do it here:
How do I change an Excel relative cell to an absolute cell?

Resources