Formula Causes Memory Leak...Sometimes?!? Help me diagnose

Tarkemelion

New Member
Joined
Jun 28, 2022
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hi Team,

I have an Excel template which itemises a list of items. The numbering of each item is what makes this task particularly challenging. Depending on the column that the item is sitting in determines the numbering increment. A picture is worth 1000 words so I'll show the general gist of it below:
1Sports
1.1Ball Games
1.1.1Soccer
1.1.2Football
1.1.2.1Touch
1.1.2.2Gridiron
1.1.3Basketball
1.2Racquet Games
1.2.1Tennis
1.2.2Badminton
1.3Other
1.3.1Archery
2Jobs
2.1Medicine
2.1.1GP
2.1.2Surgeon
2.2Law
2.2.1Solicitor
2.2.2Prosecutor
2.3Engineering
2.3.1Civil
2.3.2Mechanical
2.3.3Electrical

As you can see, the numbering scheme is a little complex. The formula adjacent to the "Sports" item is:

Excel Formula:
=IF(C2="",IFERROR(LET(d,".",c,XMATCH("*",C2:F2,2),p,A1&d&0,TEXTBEFORE(p,d,c-1)&d&(INDEX(TEXTSPLIT(p,d),c)+1)),0),COUNTA(C$2:C2))

This effectively searches for how many main headings are in Column C (i.e. Sports, Jobs etc.), and the rest of it tries to determine the step that needs to be expressed by looking at the number immediately above.

It seems effective and I'm happy with it.

To the problem: I noticed that my template was freezing when I added in new rows, particularly deep into the template (i.e. row 200-300+). By screen freeze, I mean that nothing on the screen would update. However, I could interact with ribbon buttons, such as the save icon, and could see the sheet execute after the supposed button press. Visually, the buttons would not react at all, but the excel sheet was working. Closing and reopening (after a save) would carry through the changes so the sheet was working, just not visually.
When I switched the sheet to manual calculations, added a new row and the corresponding data and then copied the formula into the numbering cell, everything was fine. As soon as I updated the sheet calculation (F9), it would freeze, leading me to believe that this is the trigger point of the problem.
I will note that there is also some conditional formatting associate with the row which formats each row depending on where the data is sitting (fairly simple things, like bold text with a light grey fill if it's a title, underlined text if it's a subtitle etc.).
Has anyone had this issue before, and know how to solve it? My formula doesn't use anything particularly volatile, so my expectation is that it isn't particularly calculation-heavy.

I want to avoid having to calculate things in a macro, but if I need to do that and then copy the results (value-only) into the numbering column to remove updating formulas from the actual sheet, then so be it.

Any and all thoughts are appreciated.

Cheers!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I've definitely seen cases where many complicated functions cause the sheet to lock up. It's kind of hard to predict, there's no good way to determine what will do it. 300 rows really doesn't seem like that many. I remember working on this problem before. I played around again, and found a slightly shorter formula with a different mix of functions. Try this:

Book1
ABCDEF
11Sports
21.1Ball Games
31.1.1Soccer
41.1.2Football
51.1.2.1Touch
61.1.2.2Gridiron
71.1.3Basketball
81.2Racquet Games
91.2.1Tennis
101.2.2Badminton
111.3Other
121.3.1Archery
132Jobs
142.1Medicine
152.1.1GP
162.1.2Surgeon
172.2Law
182.2.1Solicitor
192.2.2Prosecutor
202.3Engineering
212.3.1Civil
222.3.2Mechanical
232.3.3Electrical
Sheet3
Cell Formulas
RangeFormula
A2:A23A2=LET(a,textsplit(A1&".0.0.0","."),s,SEQUENCE(,COUNTA(a)),b,XMATCH("*",C2:F2,2),TEXTJOIN(".",1,IFS(s<b,a,s=b,a+1,1,"")))


Try this and see if anything changes. If not, I think you'll probably have to resort to VBA.
 
Upvote 0
Solution
Is there other 'stuff' associated with this list - in cells to the right, for example?

I know this is an Excel page but that sort of numbering system is the sort that a properly set-up Word template would eat for breakfast.
 
Upvote 0
Is there other 'stuff' associated with this list - in cells to the right, for example?

I know this is an Excel page but that sort of numbering system is the sort that a properly set-up Word template would eat for breakfast.
Agreed, but there are unit costs, quantities, and total costs associated with the template. Definitely needs to be a spreadsheet!
 
Upvote 0
I've definitely seen cases where many complicated functions cause the sheet to lock up. It's kind of hard to predict, there's no good way to determine what will do it. 300 rows really doesn't seem like that many. I remember working on this problem before. I played around again, and found a slightly shorter formula with a different mix of functions. Try this:

Book1
ABCDEF
11Sports
21.1Ball Games
31.1.1Soccer
41.1.2Football
51.1.2.1Touch
61.1.2.2Gridiron
71.1.3Basketball
81.2Racquet Games
91.2.1Tennis
101.2.2Badminton
111.3Other
121.3.1Archery
132Jobs
142.1Medicine
152.1.1GP
162.1.2Surgeon
172.2Law
182.2.1Solicitor
192.2.2Prosecutor
202.3Engineering
212.3.1Civil
222.3.2Mechanical
232.3.3Electrical
Sheet3
Cell Formulas
RangeFormula
A2:A23A2=LET(a,textsplit(A1&".0.0.0","."),s,SEQUENCE(,COUNTA(a)),b,XMATCH("*",C2:F2,2),TEXTJOIN(".",1,IFS(s<b,a,s=b,a+1,1,"")))


Try this and see if anything changes. If not, I think you'll probably have to resort to VBA.
Thanks mate, I've got a couple of other formulas that do the same to greater or lesser extents so I'll try those too and see if it avoids the issue. Otherwise I'll have a go at the VBA.

Appreciated.
 
Upvote 0
It looks like this is a conditional formatting issue, now that I've spent more time investigating.

I'll mark the query as closed, and I appreciate the thoughts and feedback from everyone who took the time to review this issue. I'll open another query in the future to see if there is a work-around for having overlapping conditional formats and such.

Cheers all!
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,793
Members
451,589
Latest member
Harold14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top