vba excel formula in locked cell changes to numeric value - excel

I have a simple formula (an AutoSum) in a protected sheet and locked cell. My VBA code does not access this cell directly. Despite this, the formula sometimes changes to the numeric result when the sum changes. Any ideas how I can prevent this from happening?

It sounds like the Cell value is being set implicitly which over writes the formula. You may have a cell reference that you are missing. If your code does not set anything in that cell, then there is something in your workbook doing it. Try going to the Formulas tab and selecting Trace Dependents. See if an arrow points to something you were not aware of. Some of my sheets get so huge that I can loose track of things. Especially if I do any cutting and pasting.

Related

How to fix formulas calculating with CTRL+ALT+F9, but not with F9

I have an excel sheet into which data gets inserted from an outside software before it is opened. It returns either the empty string ("") or the number as string.
There is some really strange behaviour from Excel now though. The Data Points get copied into another cell without a problem although the 0s do not get inserted. Instead the cells just stay empty. The formula depending on that value just shows #NV.
The formulae seem to be correct as when one of the Origin cells is clicked and Enter is pressed, the depending values get calculated correctly.
Also "F9" doesn't do anything while CTRL+ALT+F9 calculates the whole sheet correctly. To me this seems really strange as if Excel just "doesn't know" the values have changed.
So we have 2 indications that don't match.
Since CTRL+ALT+F9 calculates all values it seems Excel just doesn't "know" it needs to calculate.
Since the values get copied it seems Excel does start doing something and stops for some reason.
I tried everything I can think of. Reformatting the cells, casting the input as an int before entering in into Excel and much more.
The formulae and result look like this. If CTRL+ALT+F9 these are all numbers instead of just the copied values that are drawn from another cell.
It looks like this:
It's German Excel
Formula left:
IF(LENGTH(G6)=0;0;G6)
Formula right:
IF(F18>0;VLOOKUP(CONCATENATE(G$2;" ";F18);Frequenzen!$A:$D;3;FALSCH);"")
Edit:
Autocalculate is turned on by the way. I also already tried putting VALUE() around everything since values are entered as strings. I don't really think formatting is a problem though as it calculates correctly when I force it to recalculate the whole sheet.
VBA is not an option as a solution since documents are saved on a server where it's not allowed.
From Support Office:
Calculate all worksheets in all open workbooks.
F9
Calculate the active worksheet.
Shift+F9
Calculate all worksheets in all open workbooks, regardless of whether
they have changed since the last calculation.
Ctrl+Alt+F9
Check dependent formulas, and then calculate all cells in all open
workbooks, including cells not marked as needing to be calculated.
Ctrl+Alt+Shift+F9
So based on the last part of what was added to Ctrl+Alt+F9 "...regardless of whether they have changed since the last calculation" to me implies that for the previous two case calculations will only occur if a change has been flagged.
I have a similar problem, in a simpler setting. My workbook just fails to recognize that a value has changed in a cell on another sheet which the cell in question is dependent on.
There are no error messages. Automatic recalc is on. There is no error in the formulas because retyping the exact same formula into the cell as was already there forces the necessary recalculation. Moreover, the problem occurs only when the workbook grows beyond a certain size (that certain size being about 6 mb on a machine with 32GB RAM). The workbook records incoming orders, with each new order being a new page, and sums across the order sheets to get order totals, and does calculations on other sheets that track inventory. All very simple. Just adding, subtracting and multiplying. If I hit ctrl-alt-f9, then all cells update to correct values.
My conclusion is Excel has a bug in its smart recalculation code.

Output result of formula on different cell without VBA

Is it possible to output the result of a formula on a different cell without the use of VBA and without directly reffering to the cell containing the formula (e.g. writting =C1 into the output cell)?
I know that this can be easily done with the help of VBA, but I was wondering if there really is no simpler way to achieve this.
I don't think so, if you dont want VBA then all I can think of is to lock the cells so they can't be updated.
How to lock just a range of cells
As far as I know all formulas display their results within the cell they occupy.
if you want to pull a value from a cell without directly referencing the cell address, you could indirectly by using the offset function. However even the offset function needs to reference at least one cell on the worksheet.

Iterate between workbooks using INDIRECT

I want to create a summary file where I wish to import the data from cell D11 from some workbooks. For this I try to use INDIRECT to call the workbook O284, where O284 through O296 consists of strings like:
2015-01 (for O284), 2015-02 (for O285 etc)
and where O285 is the sheetname, which is consistent for each workbook hence the $$'s.
=INDIRECT("'C:\Path\["&O284&"]"&$O$285&"'!$D$11")
Running this however does not return a value, but merely a ####. I have all the workbooks opened. I suspect I conduct the INDIRECT snippet wrong, but I can't figure out how. Does anybody have a clue?
Regards,
Btw, is there a way to achieve the same thing as with INDIRECT that work with closed workbooks without using macros? Like a "paste value" or something which you can use in the same way as INDIRECT but that returns a digit, without the formula notation in the cell?
EDIT:
=INDIRECT(CONCATENATE("'C:\path\[";O282;"]";$O$283;"'!D11"))
works for getting the value "D11" from the workbook O282. When I drag this formula out, the next column will reference to workbook P282. However, it still get cell D11. I want it to get the E11 cell from this workbook, and work like this. Does anyone have any idea?
=INDIRECT(CONCATENATE("'C:\";[#Path];"\[";[#WorkbookName];"]";[#SheetName];"'!";ADDRESS(11;COLUMN() - 11)))
I think up code is something that can you want.
Showing #### is sometimes because of cell width.

Excel calculation error when creating new sheet

Description of my application in Excel:
I import data to a sheet called RAWDATA
Another already existing sheet Table1 is to be populated by data from cells containing references to RAWDATA.
The reference =RAWDATA!$A$1 is in one of the cells of Table1.
When I run the application, the previously mentioned cell returns #REF!.
I try to update calculations, manipulate with application calculation manual. I still get #REF!.
I click in the formula bar of the #REF! cell. Press enter. It calculates correctely.
What can I do to fix this?
Note that I can only use worksheet functions for the process of getting values to the table, not VBA code.
It is possible to postulate a theory that could explain this behavior. However, I would like to listen to an expert's opinion on this matter.
The issue in brief:
=RAWDATA!$A$1 returns a #REF! error.
#REF! error does not go away with recalculation, but it goes away by:
Using INDIRECT("=RAWDATA!$A$1") instead of =RAWDATA!$A$1.
Clicking on the formula bar of the #REF! cell and pressing enter.
I believe that excel does not recognize the data type that you import from the other application. Therefore, a reference to this data causes the #REF! error.
Can you check if this claim is true?
If it is false, it invalidates whatever is written below.
Excel has a built-in automatic conversion mechanism. For example, if a cell is formatted as text but it looks like a number (say " 10 ") then adding a numeric value to that, is legitimate, because excel internally converts that text to a number.
For some reason, the automatic conversion tool of excel does not work when you recalculate the sheet, but it works when you activate the reference cell and press enter (so when only the cell is recalculated). Also, it is triggered by INDIRECT.
So I tend to believe that the mechanism that infers the cell value type is induced by INDIRECT and by pressing enter in the formula bar, but not by recalculating the sheet.
PS: INDIRECT is a volatile function (it is reevaluated every time that excel recalculates) but since recalculation does not work in the first place, this is probably irrelevant.

Excel 2013 Forumla Not Working in some Cells

SO I'm trying to get some work done in Excel 2013, and after getting an initial formula to work, I dragged it across several other cells. I did all the standard locking of references and such, even copied the exact formula into the new cell formula window with copy paste. The formula works in the first cell, not in those it's dragged over. It also works in seemingly random cells when pasted around (see screen shot).
Formula is below... this was a brand new sheet, the cells had not been initialized until the formula was pasted. Is this an issue with Excel 2013? Since the formula works in some pastes perfectly, and not in others, I don't think that's the issue... I changed the cell format after the pastes in a couple cells to see if that changed results at all - it does not.
Update: I added in the false value, and the IF is evaluating to false on the zero cells... why it's correctly true in some, and false in others is still a mystery.
=MIN(IF('Metrics'!$DL$2:$DL$1725=$L$2&$O$2,'Metrics'!$DH$2:$DH$1725))
The issue is that for the formula to correctly evaluate it should be set as an array (ctrl-shift-enter).
However, Excel 2013 seems to randomly recognize the formula as an array formula, and sometimes not. Thus the formula occasionally will work, in a brand new, uninitialized cell, using/displaying the standard formula, and a correct result. Other times it will still display the same formula, but produce incorrect results since it is not being evaluated as an array.
Any of the cells that did not magically convert to an array formula, when changed to array, will update with correct values.
Only manually changed cells reflect the {=MIN(IF(...)...))} indication of an array formula. Cells in which the formula produced correct results still display as a non-array formula.
I had a similar if not exactly the same issue. Try hitting F9 to recalc the sheet, or go to File>Options, go to "Formulas" and under "Workbook Calculations" set it to "Automatic".
Solved my problem, which manifested the same way yours did.
Good luck!
Since you are,using $ sign to lock the cells in the formula, it looks like you are just pointing it to the same cells giving you same results... Click on the formula and check or change to the correct reference cells as you desire...
turns out my 2003 excel problem was due to some circular formulas. Had "Circular:" at the very bottom line. When these all fixed, the other cells started to calculate properly.

Resources