Locating Lost Excel Macro Formula From Old Data Sheet - excel

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.

Related

The date displayed in an Excel sheet differs from the actual value in that cell

I came across a strange Excel book at work. When I retrieved a date value from any sheet in that Excel book, that value didn't match the date that it is supposed to represent.
However, the value 42978 doesn't represent 9/1/2021, but 8/31/2017. In fact, if you copied that cell to any cell in any sheet in another book, you would see 8/31/2017 in that cell. On the other hand, that value would always go 9/1/2021 in any cell in the original book. As seen, even though the macros have been disabled, I don't know how it can do that. I can't continue to work with that. Can someone please help me?
I would like to upload that Excel book, but probably can't contractually. And all macros in the book are password protected from editing and deletion, so I can't even see the contents of the macros.
There is an option within Excel which makes use of different date-systems: see https://learn.microsoft.com/en-us/office/troubleshoot/excel/1900-and-1904-date-system
Open Excel Options
Goto Advanced
Scroll down to When calculating this workbook and check/uncheck Use 1904 data system
This should fix your problem.

Downloading File with importrange function failing - think it's a bug

I've been saving Google Sheets to Excel without any problems for a while. These sheets have always successfully saved and opened in Excel with the importrange function. However, recently it hasn't been successfully saving correctly.
It used to just have the static value (e.g, 40). There used to be an IFERROR in the first cell in the header row but now it exists in every single cell.
E.g, each cell would have something like this:
=IFERROR(__xludf.DUMMYFUNCTION(importrange(blahblah)),"40").
DUMMYFUNCTION throws an error and "40" is returned as a result. but "40" is a string, not an integer which messes up all my formulas.
I also know this isn't an Excel issue because OpenOffice is doing the same thing with the file.
I'm pretty sure this would be a bug because why would it be working for months and then suddenly stop working?
What should I do?
I'm thinking it's a bug too.
Workarounds
On Excel
Copy and paste as values only the ranges with IFERROR(__xludf.DUMMYFUNCTION(..., then use Excel's UI tools to convert numbers shown as text to numbers.
Selectively remove quotes on the IFERROR second argument of the cells causing problems
Remove =IFERROR(__xludf.DUMMYFUNCTION(),"value") except value (we could use Excel's built-in FIND & REPLACE for this)
On Google Sheets
Use Copy > Paste as values only on the range areas having formulas with non-compatible functions like IMPORTRANGE, QUERY, FILTER, etc.
If you only need the values, download it as CSV instead of XLSX
IMPORTANT
In order to help to prioritize this issue, send feedback to Google. To do this open a Google Sheets spreadsheet, click on Help > Report a problem, then fill the feedback form and submit it.
Related stuff
I posted 5 small articles about this in Spanish. You could find them listed on https://www.rubenrivera.mx/p/descargar-hcg-excel.html.
We accidentally created a workaround for this bug with a different sheet that was just set up like this.
This works when you IMPORTRANGE into another Google Sheet. We are doing it into a Google Sheet with a single worksheet - haven't tried it with multiple.
It's going to sound a little nuts but it works for us.
In the first cell of your import range put a hyperlink in the original document you are importing from. This is in the first cell of the import range. We linked it to a worksheet in the original document. It has worked and failed with an external link. With an external link it worked when I linked it to an internal link, then changed it. But when I deleted the cell and just straight linked it to an external URL it didn't work.
Then #timbo was right - put data validation in. This can be in part of the document that isn't being imported into the second sheet. I put it in the first line of the import range but outside what I was importing. It might have to be the first line. I just put a date in one cell, then in the next cell data > data validation > then choose that one date as the data range.
For aesthetics I have hidden the first row in one Google Sheet I am importing into. In another I made the first cell link the title of the sheet and put the data validation outside the import range. Both of these work.
Let me know if this works for you.
Until this bug is fixed, a workaround is to put a data validation (Data > Data Validation) on the imported data (Any kind of data validation will do).

Replicate Google spreadsheet array formula in Excel

I’ve got Google form survey data I’d like to analyse. In my example doc,
Sheet 1 contains the survey responses and sheet 2 references the data in sheet 1. Sheet 2 is where I am using this array formula under the column called Behaviour:
=ArrayFormula(if(len(A3:A),if(Sheet1!Question3="Yes","Excluded ",)&if(Sheet1!Question5="Yes","Arrested ",)&if(Sheet1!Question6="Yes","Alcohol ",)))
The issue is that I need to be able to download this Google spreadsheet as a Microsoft Excel doc but whenever I do that, of course the Google spreadsheet =ArrayFormula() function is not supported in Microsoft Excel.
My question is how could I replicate this array function’s behaviour using another method in Google spreadsheet so that I get the same result when it’s downloaded to Microsoft Excel?
What I’ve been able to find in the forum so far are questions on how you can manually copy formulas to multiple rows in Excel. The trouble with these methods are that the user has to do it by either clicking and dragging the bottom right-hand corner of the cell or by using shortcuts. I’d like my process to work so that the user doesn’t have to manually do anything.
Many thanks in advance.
Excel support array formulas but it does that in a different way than Google Sheets.
Instead of an ARRAYFORMULA function, Excel requires that the formula autor/editor, first selects the area to which the array formula result should be extended, then enter edit mode and press CTRL+SHIFT+ENTER. See Create an array formula that calculates multiple results on Create an array formula
It is possible to replicate the Google Sheet ArrayFormula in MS Excel using the OFFSET() formula even if it's not as simple as the ArrayFormula function.
The full documention of the function can be found here.
https://support.office.com/en-us/article/OFFSET-function-C8DE19AE-DD79-4B9B-A14E-B4D906D11B66
A quick example
Google Sheet
= ARRAYFORMULA(SQRT(Sheet2!A:A))
=> This will copy the full column A for the Sheet2 taking the square root of each value.
Excel Version
= SQRT(OFFSET(Sheet2!A1,0,0,COUNTA(Sheet2!A:A),1))
=> This will take a reference of the column, but we have to manually specify the height and width of the reference before taking the square root of each value.
You may very well discover that this is not possible; at least not in every case. There may be a few formulae which have the exact same definition in Google sheets and Excel. however, it's not guaranteed to work in general.
Some more detailed information here: Sheets vs Excel forumlae

Why can't Excel update some of the links in my workbook

I have a Master workbook in MS Excel that references data in 4 other workbooks.
When it opens I get the following message:
We can't update some of the links in your workbook right now.
You can continue without updating their values, or edit the links you think are wrong.
[Continue] [Edit Links...]
Each referenced workbook contains a N row, 365 column rectangular range that I have named 'DataRange'
My master workbook contains 4 lots of N row, 365 column ranges with Array Formula linked to these named ranges:
{='C:\Path\[Workbook1Name.xlsx]Sheet'![DataRange]}
It feels like i've come across an Excel bug.. Anyone know what I'm doing wrong?
Are you using MS Excel 2013, when you receive this error?
If so, it maybe due to the "3D reference in your named DataRange" in Excel 2013 or because you're referencing a range or cell in a closed workbook.
Excel allows the defining of names that refer to specific cells or ranges of cells in that workbook, similarly (using the Define Name tool in the Formulas tab) you can assign a formula to a name and then use that name in place of the formula.
The named formula or named data range is part of a collection in that workbook's (workbook1) objects and can be used in different workbook (workbook2), but the link to the defined name in the other workbook must be done one of two ways.
Link the defined name with a formula like this
='C:\Folder\Path\Workbook1.xls'!NamedFormula or NamedDataRange
Or Create a defined name in workbook2 (it can have the same defined name as workbook1's or a new name) and then refer workbook2's defined name to workbook1's defined name. Select Define Name on the Formula tab and copy a link like this in the Refers To Field:
='C:\Folder\Path\Workbook1.xls'!NamedFormula or NamedDataRange
Note these links will only work when being used in simple formulas which treat the link as a direct links. It will not work with more complex formulas when the original workbook (workbook1) is closed because the link is often treated as an indirect link in complicated formulas.
To work around this issue, use either of the following methods:
Save workbook1 and workbook2 as .xlsb files.
Do not add an external reference link to a defined name that refers to a 3D reference or named range.
Or open both workbooks
For more detail information, please refer to the following link:
https://support.microsoft.com/en-us/kb/2755120
If you're still receiving an error/ warning message after trying all my above suggestion. You might want to some troubleshooting.
Try this:
- Open Excel. Under Tools->Options->Calculation, select the Update remote
references box.
Open your workbook. Make sure the box the remote reference box is checked. Save your workbook this way after updating the link. Close workbook and Excel.Restart Excel and open your workbook.
- Look under defined names and delete all that you don't need or that have broken formulae. Run a FindLink search, to pin point the problem.
This process worked for one of workmates with this exact problem.
I hope this helps, if not let me know. There might be a 4th solution.
I finally solved this issue after going on a scavenger hunt. In my case, the reference was to an old file that no longer exists, and removing the reference was all that was needed. Unfortunately Excel does not pinpoint where the reference is, so it was a pain to look for the cell that was making the reference.
In my workbook, it was a reference as a part of a Data Validation. For others seeing the same error, I recommend using the Find & Select -> Go To Special feature (Home ribbon tab) then searching by Formula errors and and Data validation.
Open Excel
Go to "Inquire" tab page in the ribbon
Select "Workbook Analysis"
Check Items\Cells\With Validation Criteria items. In the "Validation Text" you might spot references to the extenal source.
The "Cell Address" column would give you the list of problematic cells.
Look around any other supsicious findings of the Workbook Analysis tool
Have you considered giving the data ranges different names? DataRange1, DataRange2 etc, or is this not possible due to other constraints. When excel says "some" of the links, how far has it got?
I got it working by ditching the FormulaArray and set the FormulaR1C1 for the entire range. Unfortunately the formula was a bit more complicated.
=INDEX(
'C:\Path\Workbook1Name.xlsx'!DataRange,
ROW() - ROW(Workbook1DataRange) + ROW('C:\Path\Workbook1Name.xlsx'!DataRange) - 5,
COLUMN() - COLUMN('C:\Path\Workbook1Name.xlsx'!DataRange) + 1)

VBA: Finding a value, copying row, pasting row somewhere else, Finding the next value

So here is what I want to do in VBA:
Find the value in E10, copy the row it is in, paste the row somewhere else (doesn't matter as long as I can find it) then finding the next row with the value E10 and doing the same thing, etc, until I reach the end of the spreadsheet
I'm really new to VBA and macros in general, so any help would be appreciated!
Generally speaking you'll find that asking questions without explaining "what have you tried" tends to be frowned upon in these parts.
I suggest that you take a look at this somewhat similar question that I answered just earlier today:
Copy & Paste row of data in Excel 2003 to different sheet by Email search
The principal differences between that one and your need are:
Instead of an InputBox, you'll use the value in E10 to run the .Find method; and
You need to create a loop. You still run the .Find method as shown in my example but you do it in a loop until you've looped through every instance of the value in E10 in the sheet. (Get the address of the first range that you find, and keep running the .Find method until you get back to that address.) Look up the While statement and the For statement in VBA help for examples on how to create a loop.
To get the value of an individual cell one way is just to create a reference to the cell range, then query the .Value property. For example a fully qualified reference could be:
Thisworkbook.Worksheets("Sheet1").Range("E10").value
There are other syntaxes which will yield the same result, but you can learn about those in time. Recording your actions using the Macro Recorder is a good way to learn about properties and methods. The problem is that in yet another part of the Excel 2010 interface that I detest, Microsoft has decided to hide the thing. To get to the Macro editor, go to File -> Options -> Customise Ribbon and turn on the Developer tab.
Give all of that a try and if you get stuck with something specific, post again with the details.

Resources