Forum Discussion
Excessive time preforming calculations
- May 19, 2021
Detlef is right, such projects better to do with data model using Power Pivot and Power Query. But that will require to rebuild everything practically from scratch.
With current workbook I'd at least to convert ranges to structured tables. That itself allows to optimize formulas and improve performance. Another variant is dynamic ranges, but that's harder in maintenance.
Some formulas could be optimized independently of above. For example, instead of calculating max of the range, keep reference on sequential numbers range and use MAXIFS to find position of max, it could be used something like =XMATCH(bigNumber, range, -1).
As for filtered rows, you may add helper column to first table as
=AGGREGATE(3,5,[@STOCK])and in next table use helper columns as
=XLOOKUP([@STOCK],tblStratCalcsNYSE[STOCK],tblStratCalcsNYSE[Helper])
Given that there might just be another way altogether to accomplish your objective--one of the wonders of Excel is how many different ways there often are to "skin the same cat"--I wonder if we could ask you to post a copy of the actual workbook. If it's too proprietary, perhaps you could create a mock-up that replicates the situation without revealing confidential or proprietary info. (From the formula, it looks like it's something to do with the New York Stock Exchange, or data from that source.)
You're clearly not a novice with Excel--a novice would not have written that formula--but it's possible even for experts to have tunnel vision, to always do things as they've done them in the past. Excel introduces new functions and capabilities as time passes; it may be that one or two new ones would work here.
mathetes Thanks for the reply. I have attached a stripped down file for your review. There are 4 worksheets : Totals (graph of various strategy use), StratCalcs (summary of all trades by stock), FileReview (list of all trades), Review (list if various strategy data and a stock's preferred strategy). What I am trying to do through formulas is use worksheet StratCalcs to filter various stocks to display (with their related figures in the header) then have worksheets FileReview & Review to automatically indicate or show filtered display of data from those corresponding stocks (represented by column Best in each worksheet - I use "1" for displayed stock and "0" if not displayed which then allows me to manually filter those two worksheets buy the Best column).
Ever since I have used the XLOOKUP and SUMPRODUCT functions my file runs VERY slow, also file now requires a double Enter for some reason. FYI - I copied the code for SUMPRODUCT off the internet because I could not figure out a way to run an IF function on a filtered list. So although I do know some Excel I am unfortunately not an expert and would never have thought to write that code.
Your help is greatly appreciated - Michael
- mathetesMay 13, 2021Gold ContributorI wouldn't know where to begin just in navigating through that workbook. I am sorry, but I don't have the time to spare to figure out how it all fits together. It is no surprise to me that it works slowly: there are far too many rows of data, far too many columns with complex functions, for it to do anything BUT run slowly. Maybe somebody else can put their finger on the issue......it exceeds my abilities.