I'd like to know is someone knows by VBA can be accessed the content of built-in "Evaluate Formula" tool? to be able to see understand better each step of how it works a formula, since the Evaluate Formula window is too small and for array formulas, that handle many values, is needed to scroll down/up.
Maybe a way to take like screenshots or the text (like when pressed F9) of each evaluation steps from Evaluate Formula Window and paste them ordered in another sheet.
I'm tested some apps (like this one) that breaks in parts/parse the formulas but doesn't evaluates the steps.
Related
I'm trying to make a complicated formula display its calculated values in excel formula bar.
For example this =(D9* AE9)+(A9-E9) be displayed like this =(4*0.88)+(3-1).
I would really appreciate your help on this!
Thank you in advance
The Excel Formula Bar always show the formula in the active cell - you cannot use VBA to permanently change one without changing the other.
If you select a portion of the formula (a subexpression) in the formula bar and press F9 excel will show you the result of evaluating that subexpression (remember to press Escape to revert back to the formula).
If you are looking for a way of understanding/troubleshooting complex formulas try Excel's built-in Evaluate Formula tool on the Formulas tab.
There are also more powerful formula explorer addin tools available commercially. These use formula parsers and evaluaters to show the user what the parts of the formula resolve to.
I'm using PhpSpreadsheet (1.15.0) to generate a XLSX document with formulas.
One of this formula is a Ctrl+Shift+Enter (CSE) formula.
When generating a document and then opening it, simple formulas (like '=SUM(A1:A2)') are evaluated. Users have nothing to deal with formulas, they just have to fill the cells.
However, I don't know how to make my CSE formula evaluated when opening. Right now, the formula is valid and correctly translated with localized functions' names, but users still have to evalute it manually by going on the cell, then in the formula bar and finally pressing Ctrl+Shift+Enter.
Isn't there any way to tell Excel, through PhpSpreadsheet, to evaluate this formula on opening?
As for example, here is my CSE formula:
=SUM(--(FREQUENCY(IF(E14:E25="CREDIT_CARD",MATCH(F14:F25,F14:F25,0)),ROW(F14:F25)-ROW(F14)+1)>0))
It seems PhpSpreadsheet can't do that right now, I don't know why.
There must be some complications about that.
But I found a pull request that fits my needs, by handling array formulas: https://github.com/PHPOffice/PhpSpreadsheet/pull/1591
I'm looking to make a bunch of my complicated formulas more readable. For example:
I know about Alt+Enter to add newlines within the formula itself. This makes the formula a little bit more manageable, but it's still not as readable as I'd like it. What else can I do to make big formulas like this one more readable?
I'm going to answer this myself as Excel 2013 doesn't have any truly good ways of doing what I want with formulae.
In my research I have found three ways of making formulae more readable. The first is something I mentioned in my question: Alt + Enter. This will insert a newline into the formula so that you can break up the wall of text. As an example you can change this:
into this:
The second method is to add a sort of comment to your formula. Personally I don't like this solution as it doesn't make formulae more readable to me, but others may like it. The method involves using the function N(). This function will return zero if given a string. For example:
Will give a result of 42 as N() returns zero.
The third method (shoutout to user shawnt00 for suggesting this in the comments) is to use named ranges. This can really help with readability as the user can convert something like A8:C14 to whatever name the user desires. To define a named range go to the Formulas table and click on "Define Name". Give the named range a name (preferably something that makes sense and not just "foo") and select the range of cells. Once done you can change something like this:
into a formula that is much more easily read:
The last method is to create extra columns and hide them (Thank you to user Quintin Balsdon for suggesting this). If, for example, you need the same value multiple times in one formula you can put the formula used to get that value into a separate cell that you hide and reference that cell. Take this formula for example:
On its own this formula isn't too bad, but if you take a close look at the formula in my question you'd see I do a very similar thing. Simply taking the index/match out and putting that into another cell and changing the above formula to
will make a complicated formula much smaller and much easier to quickly check what the value of J1 represents.
I have an excel sheet with three sum functions. The sheet is a template, so the rest of the sheet is blank, except for a couple text descriptions in Column A.
I use an ETL process (Talend Open Studio) to open the worksheet, input some data, append a couple other sheets, and save this different worksheet in a file share.
When I open the worksheet in the file share, the three cells with the sum functions show as zero, but when I double-click the cell, they calculate correctly.
I would like for the cells to show their calculation without me double-clicking them.
The cells are formatted as General, and the Calculation option is set to Automatic. What can I do?
select all, find-replace = with = and excel will see the contents as a formula.
I have seen such problem occurs when exporting data from "NoSQL" databases such MongoDB, etc.
You can insert a column in right side and go to the "Data" tab -> "Text to Columns" option.
Make sure you select appropriate format while separating.
Whatever you want to separate will shift to right side. Now delete this undesired column. You are done.
It is possible that Excel is seeing the cells as Text, despite the fact that you have formatted as General. This can be the case when dealing with data coming from an ERP such as SAP.
Try these two approaches to see if one works:
Approach 1
Transfer your data to another sheet by Copying your data cells and paste special (values) into another sheet
Then copy and paste your formulas into the other sheet and see if that works.
Approach 2:
For all the cells you're having trouble with, enter formula =Value([your cell]) in fresh column
Copy that column and Paste Special Values over it
Point your formulas to this new column
It's hard to reproduce the problem you're having unless you have a datasource that is exhibiting the issue. But one of those approaches may help.
How that idea worked for me:
Assumption: Source Data in Column A2
Data is "$4,238.74 "
In B2 = RIGHT(A2, LEN(A2)-1) to clear the leftmost and stubborn character ("$" that would not clear with find and replace)
In C2 = LEFT(B2, LEN(B2)-1) to clear the rightmost and stubborn character (identified as unicode 160 that would not clear either)
After the above cleaning was done the cells still would not work with something as simple as SUM() without double clicking each cell manually.
Since that is not efficient User6574133's divide by 1 idea was applied:
In D2 = C2/1 this called the stubborn (C2) cell that wouldn't calculate and created workable clean data in D2 that would calculate without having to double click each cell manually.
In a blank column Put divide the same number by 1 (eg = 5.223/1 = 5.223) Problem solved
It could be that you have calculations set to manual instead of automatic. To fix this, go to the Formula tab/Calculation/Calculation Options/tick Automatic.
I fixed mine merely by going to formulas, calculation tab, "calculate now". It woke Excel up.
Actually, go to Formulas, Calculation Options, and you will see it is set to MANUAL, change it to AUTOMATIC. I believe some update must have changed it to Manual.
I solved in a very simple way: try saving the file with OpenOffice.
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.