Question : Excel cell show one formula and calculate using another hidden one

I have an excel file, on column H, it has a series of cells containing formulas like
 =SUM(E2*1.2*$G$4)

However, If you double click the cell. Then it becomes 0. As we can see, the cell showed formula involves cell E2. Even if we delete column E, it shows =SUM(#REF!*1.2*$F$4), how ever it still displays the previous calculation result, instead of a error message. If you calculate using the formula shown, you will see that the results is not from the formula shown.

Anybody can give some comments to help me to fix and understand the situation?


 

Answer : Excel cell show one formula and calculate using another hidden one

Without seeing the workbook I can't help much more...would you be willing to email it to me? My email address is in my profile.

Another option is to obfuscate the values in the workbook. The macro below will obfuscate all the values in the current selection. To use, add the code to a general code module in the workbook, select the cells to obfuscate, and run the macro "ObfuscateSelection". Repeat for all values in the workbook that are sensitive. It handles strings, numbers, currency, and dates.

Public Sub ObfuscateSelection()

   Dim Cell As Range
   
   For Each Cell In Selection
       If Not Cell.HasFormula And Len(Cell) > 0 Then
           Select Case VarType(Cell)
               Case vbString, vbDouble, vbCurrency
                   Cell.Value = ObfuscateString(Cell.Value)
               Case vbDate
                   Cell.Value = Cell.Value + Int(Rnd() * (Now() - Cell.Value) * 2 - (Now() - Cell.Value))
           End Select
                   
       End If
   Next Cell

End Sub

Private Function ObfuscateString(ByVal Value As String) As String

   Dim Position As Long
   
   For Position = 1 To Len(Value)
       If Mid(Value, Position, 1) Like "#" Then
           Mid(Value, Position, 1) = Mid("0123456789", Int(Rnd() * 10 + 1), 1)
       ElseIf Mid(Value, Position, 1) Like "[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]" Then
           Mid(Value, Position, 1) = Mid("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", Int(Rnd() * 52 + 1), 1)
       End If
   Next Position
   
   ObfuscateString = Value

End Function

There are many possible causes for corrupted workbooks. The most common are problems with the internal tables used to store cell formatting information and corrupted p-code. It is usually very difficult to determine the cause. Below are some techniques for repairing a corrupt workbook.

If access to Excel 2007 or later is an option then open the workbook using 2007 or later, export the VBA code to files, save the workbook as XML, re-import the VBA, and save the workbook in the desired format.

An easier solution is to use a third party tool such as Excel Workbook Rebuilder from VBUsers.com (http://www.vbusers.com/commercial/Rebuild.asp).

Kevin
Random Solutions  
 
programming4us programming4us