Hacker News new | ask | show | jobs
by Jtsummers 1667 days ago
Not without dropping into VBA, at least last I looked. The cell dependency graph should form a DAG. If there is a cycle, it will break (Excel will detect this). A common way to produce a "loop" is to create a row for each iteration depending on the one above (which can actually be handy to see convergence and intermediate values). This means there's no way to do something like:

  // initial
  A1 = 0
  A2 = 100 (the limit)
  A3 = =A3+A1 (self referential, 0 initial)
  // somehow
  A1 = 1
  A2 = 100
  A3 = =A3+A1 == 1
If you could refer to previous values it might be possible, but would also force some synchronization into the process that might be problematic. Like you'd need A1 to only update after A3 has had a chance to read it, then the next, then the next.
3 comments

Excel supports iterative calculations, which allows you to use circular references. If you enable it, you need to specify a maximum number of iterations excel will run on each update. I believe you can also specify a minimum delta which will cause Excel to terminate early if subsequent iterations differ by less than the delta. I suspect the reason you need to press f9 repeatedly is this project uses circular references, but running your program takes longer than the maximum number of iterations, so pushing f9 allows it to run for another set of iterations.
That makes sense, I've never made use of that. Apparently that was available as early as Excel 2007, I've just never come across it and haven't used Excel for much more than a scratchpad in years now.
Goal seek also covers various optimization / iteration scenarios.

Or solver.

Options exist for iterations and maximum change directly with circular references.

https://bettersolutions.com/excel/formulas/circular-referenc...

Adding in indirect/offset/lookups/indexes etc - I've gotten surprisingly far.

I'm also OK doing VBA BUT the MAJOR downside of VBA - horrendous to share it and got worse over time for security reasons.

Excel without VBA - you can give the "program" to anyone, and almost anyone can use it (and in a pinch change it).

This sounds like we're going to learn about macro and VB viruses all over again.