I've encountered an unusual bug in Excel that results in the whole programme crashing without warning, any form of error notification (including upon startup), or any acknowledgement that it crashed. This occurs when I have a particular workbook open and then I try to open another one; at this point Excel effectively just 'end task's itself.
I've played around with a copy of the workbook at fault and seem to have narrowed it down to a combination of four factors. If any of these factors are removed the bug doesn't appear to occur, and creating them in a fresh workbook seems to cause the issue to occur (i.e. it's replicable and not just that specific original workbook).
These four factors are as follows:
Factors 1 & 2 are on a cell (let's say B2; but see my additional notes) that contains a date:
Factor 1: A conditional formatting rule with the formula:
=NOT(OR(CheckIfDate($B2),$B2=""))
(the CheckIfDate function is covered in Factor 4)Factor 2: A conditional formatting rule with the formula:
=AND($B2-TODAY()>1,$B2-TODAY()<=10)
Factor 3: Another cell (let's say C2; but again, see my additional notes) that contains the formula
=IF($B2="","",IF($B2-TODAY()<=1,5,IF($B2-TODAY()<=10,4,IF($B2-TODAY()<=30,3,IF($B2-TODAY()<=90,2,1)))))
Factor 4: A VBA function with the following code:
Option Explicit Function CheckIfDate(Test_Cell as Range) as Boolean CheckIfDate = IsDate(Test_Cell) End Function
At this stage I could probably tweak 1+ of the factors to avoid the bug, but I'm keen to understand what's going on before deciding what the best course of action going forward is. Any help/support would be greatly appreciated, and I'm happy to provide additional information, etc. if needed.
Additional notes:
I can confirm that this is not machine specific (I was able to replicate the issue on a colleague's machine)
It appears that this bug either doesn't impact all versions of Excel, or could even be specific to the one in question. The one being used is a 32-bit Office Professional Plus 2016 version (build number is 16.0.5254.1000). I tried to replicate it on a 64-bit 365 version (build number 16.0.14729.20254) and that seemed to work without issue; thus making me think the issue might be tied to 32-bit limitations?
In terms of the two mentioned cell locations, there seems to be some weak link between their location and the issue occurring. I was able to determine that when they were next to each other like in my example, the issue occurs, but that when they get further apart the issue seems not to trigger. I've not yet determined how far the 'trip' point is so to speak; but it appears there can be a couple of columns and/or rows between them and the issue still occurs (thus it's not a case of "they have to be directly next to each other")
My initial thoughts when trying to nail down exactly what factors contributed the bug was that it would be related to the fact that TODAY() is a volatile function and it's used quite heavily here. But given Factor 1 doesn't include that function I'm not so sure anymore. However, the obvious link between the 4 factors is that they all relate to dates in some shape or form; but that may be coincidental.