Article updated on August 11, 2017

I found a really interesting workbook that calculates the shortest distance from a start cell to an end cell. It is all made with excel formulas, not a single vba line! It uses a grid of 12 by 12 cells and the workbook is 11 MB.

He implemented Dijkstra's Algorithm to calculate the shortest path. If you are interested in how it works download his workbook.

I wanted to see if it was possible to make a bigger grid so I made a grid of 30 by 30 cells. The workbook quickly grew to 60 MB and there are 8 sheets. The maze is built by entering 1 for a wall cell. Conditional formatting then makes the cell black.

The animation below shows me deleting walls and the workbook instantly finds a new shorter path.


I also tried making an even larger grid, 65 x 65 but the workbook became too big. You can see my labyrinth here.

maze - large grid

I guess this is a task for vba but that will be another post. [UPDATE] The follow up post is here: Finding the shortest path – A * pathfinding