Replacing entire column with fixed range in formulas - excel

I have a bit of a strange problem that I'm trying to solve.
I have a large macro-enabled Excel file that takes around 3 minutes to calculate all the formulas in it. I did not create this file but I'm trying to see if there is a way to expedite the calculation.
I have tried all the usual tricks of disabling screen updating, changing calculation to Manual but I also noticed that almost all of the formulas in this file reference entire columns instead of fixed ranges so $A:A instead of A1:A1000 or similar.
There are different formulas on different tabs so I was wondering if there is a way to dynamically replace such instances with a fixed start and end cells. I know I can use Find/Replace but I don't want to have to do it for every single formula if there is a better way to do it using VBA.
Essentially, I'd like to be able to read each cell on a worksheet and replace entire columns with fixed ranges. For example:
Old formula: =IFERROR(INDEX('426'!$CC:$CC,MATCH($J14&"Space",'426'!$CN:$CN&'426'!$CB:$CB,0)),"")
New formula: =IFERROR(INDEX('426'!$CC1:$CC5000,MATCH($J14&"Space",'426'!$CN1:$CN5000&'426'!$CB1:$CB5000,0)),"")
Thank you!

Related

How To Create A Unique List From Multiple Sheets Using Excel Formula

I am working on a payroll sheet, and I need to extract Unique Employee ID from multiple sheets in the workbook and place them in the same workbook in another sheet.
Although I am able to create a formula, to get those Unique List however I am not able to make it dynamic, since every month I shall be importing a new sheet in the workbook and that should be taken into consideration, which is not working out with my formula.
I have tried using the INDIRECT Function to dynamically refer all the sheets but in vain may be I am doing something wrong here. I know it can be done with Power Query but I dont want to change the structure of the database also its possible with VBA, but I'm reluctant to it, specifically want to accomplish it using Excel Formula.
The below formula which I have used in Master_List Cell A2
="ID_"&SORT(SUBSTITUTE(UNIQUE(
FILTERXML("<a><b>"&SUBSTITUTE(TEXTJOIN(",",,Blad1:Blad3!A2:A1000)
,",","</b><b>")&"</b></a>","//b")),"ID_","")+0)
I tried using this as SHEETS Defined Name within the formula, but it gives #REF Error
=SUBSTITUTE(GET.WORKBOOK(1),"["&GET.WORKBOOK(16)&"]","")&T(NOW())
The above formula, is used for grabbing other sheets data for calculations, tried implementing it within the formula by wrapping it within INDIRECT function, but doesn't work, I know why is n't will it possible to make it dynamic or is there any workaround. I hope am able explain. Thank you for the effort and time.
Note: This is a sample data, created for the query.
If you insist on formulae, here is what I did to make this work:
I created a name formula in the name manager: SHEETNAME. It refers to: =REPLACE(GET.WORKBOOK(1),1,FIND("]",GET.WORKBOOK(1)),"")
Assuming you have at least two sheets (a 'Master' and any other sheets have ID's in column A;
Now I used in A2 in the masterlist:
=UNIQUE(FILTERXML("<t><s>"&REDUCE("",SEQUENCE(SHEETS()-1,,2),LAMBDA(a,b,TEXTJOIN("</s><s>",,a,INDIRECT(INDEX(SHEETNAME,b)&"!A2:A100"))))&"</s></t>","//s"))
Note1: I assumed you have only got ID's in the range of A2:A100 to keep it rather simple.
Note2: This use of TEXTJOIN() can hit it's limits rather quick.
Note3: You could try to nest a 2nd UNIQUE() that would make sure that each iteration handles as little as records as possible. This would hopefully make sure that the limits of TEXTJOIN() aren't hit as quickly.

How to fix formulas calculating with CTRL+ALT+F9, but not with F9

I have an excel sheet into which data gets inserted from an outside software before it is opened. It returns either the empty string ("") or the number as string.
There is some really strange behaviour from Excel now though. The Data Points get copied into another cell without a problem although the 0s do not get inserted. Instead the cells just stay empty. The formula depending on that value just shows #NV.
The formulae seem to be correct as when one of the Origin cells is clicked and Enter is pressed, the depending values get calculated correctly.
Also "F9" doesn't do anything while CTRL+ALT+F9 calculates the whole sheet correctly. To me this seems really strange as if Excel just "doesn't know" the values have changed.
So we have 2 indications that don't match.
Since CTRL+ALT+F9 calculates all values it seems Excel just doesn't "know" it needs to calculate.
Since the values get copied it seems Excel does start doing something and stops for some reason.
I tried everything I can think of. Reformatting the cells, casting the input as an int before entering in into Excel and much more.
The formulae and result look like this. If CTRL+ALT+F9 these are all numbers instead of just the copied values that are drawn from another cell.
It looks like this:
It's German Excel
Formula left:
IF(LENGTH(G6)=0;0;G6)
Formula right:
IF(F18>0;VLOOKUP(CONCATENATE(G$2;" ";F18);Frequenzen!$A:$D;3;FALSCH);"")
Edit:
Autocalculate is turned on by the way. I also already tried putting VALUE() around everything since values are entered as strings. I don't really think formatting is a problem though as it calculates correctly when I force it to recalculate the whole sheet.
VBA is not an option as a solution since documents are saved on a server where it's not allowed.
From Support Office:
Calculate all worksheets in all open workbooks.
F9
Calculate the active worksheet.
Shift+F9
Calculate all worksheets in all open workbooks, regardless of whether
they have changed since the last calculation.
Ctrl+Alt+F9
Check dependent formulas, and then calculate all cells in all open
workbooks, including cells not marked as needing to be calculated.
Ctrl+Alt+Shift+F9
So based on the last part of what was added to Ctrl+Alt+F9 "...regardless of whether they have changed since the last calculation" to me implies that for the previous two case calculations will only occur if a change has been flagged.
I have a similar problem, in a simpler setting. My workbook just fails to recognize that a value has changed in a cell on another sheet which the cell in question is dependent on.
There are no error messages. Automatic recalc is on. There is no error in the formulas because retyping the exact same formula into the cell as was already there forces the necessary recalculation. Moreover, the problem occurs only when the workbook grows beyond a certain size (that certain size being about 6 mb on a machine with 32GB RAM). The workbook records incoming orders, with each new order being a new page, and sums across the order sheets to get order totals, and does calculations on other sheets that track inventory. All very simple. Just adding, subtracting and multiplying. If I hit ctrl-alt-f9, then all cells update to correct values.
My conclusion is Excel has a bug in its smart recalculation code.

Excel Summing Multiple Cells Based Off Row & Column Indicators

So, what I have is an excel sheet that is automatically generated by a program, so reformat is not an option:
Example Worksheet
General format of this excel will stay the same, with some additional rows depending on the day.
I’m trying to create a formula that I will use from another worksheet (I can handle linking from another workbook) that will give the total number of Boxes for that day.
For example, the correct answer for this day would be 85.
I have tried a few formulas but they have not worked for me.. I am most likely missing something. I tried getting all numbers relative to the “Totals:” cells, and just distinguishing the “* Box” columns with SUMIF but that didn’t work either.
Ideally: Have the formula look at cells in the same row as the “Totals:” rows(blue), but only in the Box Columns(orange) to pinpoint all the (green) cells and add them all up for a grand total.
Colors were just added for visual reference.
Any help is appreciated.
Try this. There may be a way to make it more compact, but I have tested and this works if your columns do not change
=SUMIF(A:A,"Totals:",I:I)+SUMIF(A:A,"Totals:",K:K)+SUMIF(A:A,"Totals:",M:M)+SUMIF(A:A,"Totals:",O:O)+SUMIF(A:A,"Totals:",Q:Q)+SUMIF(A:A,"Totals:",S:S)
After a quick test something this might work (as an array formula):

Alternative to INDIRECT

I'm using the INDIRECT function to fetch data from another table sheet.
The direct way would be "sheetname!A5". I need it dynamically, so the sheetname is also part of the table, using indirect "indirect("'"&G$1&"'!A5"), whereas G1 contains the sheetname works fine.
INDIRECT is horribly slow, which outperform my project because I need a lot of fetches.
Is there a less powerful / more performant function to fetch data from variable sheets?
I've run into similar situations - depending on how frequently your 'results' worksheet changes, it may be best to create a formula dynamically that initially 'writes' hardcoded formuls. For example: ="='"&G$1&"'!A5".
Then copy that formula as you wish; it will create text strings that represent what you want the formulas to look like. Then copy & paste as values - you will now have the desired formula entered into each cell. By default, Excel will still display each cell as a text string, even though the format type would be general (assuming it was beforehand). From there, different solutions are possible - if you have few enough cells it may be enough to just start at the top pressing F2 then Enter, repeatedly, to get Excel to calculate each cell.

Excel cells don't calculate until I double-click them

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.

Resources