## Shortest path

*Article last 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.

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

Optimize pick path in a warehouse

As you probably already are aware of I have shown you earlier a vba macro I made that finds the […]

Finding the shortest path – A * pathfinding

Two months ago I posted some interesting stuff I found: Shortest path. Let me explain, someone created a workbook that calculated […]

A quicker A * pathfinding algorithm

3 weeks ago I showed you a A* pathfinding algorithm. It was extremely slow and sluggish and I have now made it […]

### 3 Responses to “Shortest path”

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Use the img tag, like this: <img src="Insert pic link here">

**Contact Oscar**

You can contact me through this contact form

Just curious how the cells change color without conditional formatting being supported in iWork Numbers. The spreadsheet works in Numbers, but I want to know which formula makes the cells change color.

[…] months ago I posted some interesting stuff I found: Shortest path. Let me explain, someone created a workbook that calculated the shortest path between a start cell […]

[…] Shortest path […]