The question closest to mine did not return a satisfactory answer.
Inserted formula with cell reference does not recognize new input
In a particular macro-enabled workbook, macro-generated formulas do not change output values when data in referenced cells is changed. For instance, I can enter some numbers in referenced cells and the formula-containing cell will show the calculated number, but those numbers will not change when changing the data in the references. Manually typed formulas in the same workbook show the same behavior regardless of being in or outside range objects or in non-macro generated worksheets within this workbook. It doesn't seem to be specific to any particular formula.
I checked that the cells are formatted as numbers and that the formulas are valid. Formulas still appear in the cells after computing values.
Reloading the same workbook without macro-enabling shows the formulas working correctly.
In another macro-enabled workbook no problem is observed.
I checked property settings in the VBA editor and found no differences between them.
It seems like something is going on related to macro-enabling and not any particular code that is causing formulas to become unresponsive, but I am stumped as to what that could be.
Here is the formula in which I noticed the problem:
in "=d4:d21" the array formula "{=IF(ISNUMBER(C4:C21), C4:C21/C3, "0")}"
Even with a simple formula placed anywhere on the sheet like "=average(f4:f6)", this problem occurs.
I think creating the macro containing these lines of code is when the issue started, but they are not specific to it:
Sub CreateDataSheet()
Sheets.Add After:=ActiveSheet
Range("d4:d21").Select
Selection.FormulaArray = _
"=IF(ISNUMBER(RC[-1]:R[17]C[-1], RC[-1]:R[17]C[-1]/R[-1]C[-1], ""0"")"
End Sub
How can I get these formulas to work again?
The calculations in the workbook were set to 'manual' and I changed it to 'automatic'. The formulas work now.
Related
Some mysterious behavior within a simple worksheet (Excel 2013 - Win7, but also continues if workbook is opened on Excel 2019 - Win10):
Cells in column "A" are getting populated with a formula after I enter a number in cell of column "C".
For example:
When I enter the number 123456 in C23, the following is automatically entered into a previously blank A23: =HYPERLINK("http://gigapan.com/gigapans/"&C23,C23) which is what I want, but how is it happening automatically? There are NO conditional formattings (that I can find), NO Worksheet_Change VBA subs running (NO VBA code at all for this workbook). The result is what I want, but it is driving me crazy not knowing how it got set up this way!!! Took the xlsx file to another computer with no Personal.xlsb to interfere and same behavior. Suggestions?
Excel example screenshot...
This is normal behaviour, controlled by the option Advanced > Extend data range formats and formulas. Described at https://support.microsoft.com/en-us/office/advanced-options-33244b32-fe79-4579-91a6-48b3be0377c4
Excel changes formulas when I open the referenced workbook, and wont change them back. Original Formula:
=IF(condition;'\\sharepoint.host.com\path\[Filename.xlsx]Sheetname'!A1;"")
by Excel modified formula:
=IF(condition;'\\sharepoint.host.com\path\[Filename.xlsx]#REF'!A1;"")
I have a few hundred of those formulas and already made a VBA-script to replace all occurences of "#REF" by the correct SheetName, so technically I have a workaround. And it works well.
But WTF?!? Why would Excel do this? And how can I stop/prevent this?
This is not related to copying cells within Excel.
Excel will put #REF when a sheet is deleted or, for some reason, becomes inaccessible.
The same happens if a cell is deleted. Had this happen when I have deleted the wrong column by accident. One reason I only ever work on a copy and keep backups.
I have vlookups to pull specific data from a workbook and paste into a new workbook in the desired layout. The layout of the first workbook never changes however the name will change when i want to run this on a different file.
My current formula is =VLOOKUP(A3,[Workbook1.xlsx]Sheet1!$B$3:$XFD$7,2,FALSE)
I would really like it to reference A1 instead of Workbook1 so I could then just update the file name in A1 every time I want to analyse a different file. I should mention the Sheet name won't ever change.
I know you have to use INDIRECT but im unsure how it works. I did try =VLOOKUP(A3,INDIRECT(A1),$B$3:$XFD$7,2,FALSE) but then i'd too many arguments and when i removed the $B$3:$XFD$7 i lost the range i was searching in.
Thanks!
With INDIRECT you must create the whole string that denotes the range reference:
=VLOOKUP(A3,INDIRECT("'[" & A1 & "]Sheet1'!$B$3:$XFD$7"),2,FALSE)
One more note, that INDIRECT requires that the workbook be open to function, or will return an error.
I'm resurrecting some old scientific data from the early 2000s.
I need to locate the custom functions that allowed the data to be shown. The spreadsheet that I have is full of #REF! cells, as they are supposed to be calculated based on a custom-defined formula (here, called 'RESECTION').
How do I find this formula? If I can see the math it was performing, I will be able to use this old data, and extend our timeseries significantly.
The spreadsheet is an ".xlsm" document. There is an associated file that is ".XLM"; it provides some GUI-like functionality that is now broken, and I do not see how to access the commands (?) or other VBA that is inside.
I have not had success with this solution.
File with the VBA can be found here; SURVEY.XLM.
Problem is seen here; calling function from SURVEY.XLM. How do I access the formula within here?
I can see that the formula is in there; how do I see the calculation it performs?
RESECTION is a named range refering to cell A4 on the hidden Survey sheet.
In the VBE immediate window type thisworkbook.Sheets(2).visible = true and then thisworkbook.Sheets(2).select.
Cell Survey!A4 contains the value =RESULT(64).
The rest of the sheet contains the macros - first time I've seen or tried to use a filled in macro sheet.
I tried Ctrl+Fto find the definition of RESULT but it comes up with Macro error at cell [SURVEY.XLM]SURVEY!A364.
I have a workbook with two sheets. The first is full of data and calculations, the second is mostly cells with references to the first sheet. The second sheet also concatenates strings, and references to cells in the sheet, to form SQL commands used elsewhere.
There is also a second workbook (soon to be more). It has a sheet identical to the first sheet of the other workbook, except with different data. The problem I'm having is that the new workbook needs a sheet similar to the second of the original workbook (sorry if this is sounding confusing). I would like to simply duplicate the sheet and its formulas, which I tried using the 'move or copy...' option. Unfortunately, the formulas in the cells reference the first sheet from the old workbook, like this: =[foobar.xlsx]data!A1. Way too much data to remove them by hand. I can't just redo the formulas because I had to remove a lot of specific lines from the second sheet, so dragging the formula would not match up correctly. I'm currently trying to hack this together with REPLACE but if anyone can offer help it would be greatly appreciated.
CLARIFICATION:
When I copy the sheet, a formula will appear as =[foobar.xlsx]data!A1. I want it to just be data!A1.
Thanks :)
I hope this answers your problem, but I am a little unclear on your need!!!
Highlight all cells in the worksheet.
Perform a replace to replace = with say '=
This stops the formulas "being formulas"
Copy the sheet.
Perform another replace on the new sheet to replace '= with =
This converts back to formulas, referring to cells in your new workbook.