Solving Sudoku with EXCEL

  • Thread starter LynnI via OfficeKB.com
  • Start date
L

LynnI via OfficeKB.com

It is possible to use Excel to solve Sudoku.
I used mainly Excel Functions and just a little VBA to make it work. I just
press one key and the answer comes up. It works for most of the puzzles from
gentle to tough(categorized by LA Times). For the diabolical puzzle, it needs
some more steps.
 
I

ilia

I have this spreadsheet that will do it, but it doesn't "solve" it,
just guess-and-check strategy. The upside of that over some "solving"
algorithms out there, is that eventually, it will come up with a
solution, whereas a solving algorithm isn't always guaranteed to do
so. This version also has a delay time setting - a (woman) friend of
mine said "yeah that's cool, but I can't see what's happening it's too
fast!" so you can set it to a couple of milliseconds delay between
trying the next iteration. Without delay, for tough puzzles it will
take between 2 and 5 minutes to figure out a solution. There is a
samples sheet that has some puzzles I found online, just copy/paste
those into the grid.

The code is quite simple, you can see it (all in the sudoku
worksheet). It's basically a single recursive function that does
everything, everything else is supplementary such as to check where
row/column/block each thing is located.

http://www.44lbs.net/ilia/061208sudoku_solver.xls

FYI, I have never solved a sudoku in my life.
 
L

LynnI via OfficeKB.com

Hi,

Your program is nice. I used totally different approach to to it. I actually
used EXCEL to solve the puzzle. I did it just as the way I did it with pencil
and paper. So my method is much faster than yours. However, I need to
develop some way to do the trial and error for some really hard puzzle that I
could not solve with my methods.
I have this spreadsheet that will do it, but it doesn't "solve" it,
just guess-and-check strategy. The upside of that over some "solving"
algorithms out there, is that eventually, it will come up with a
solution, whereas a solving algorithm isn't always guaranteed to do
so. This version also has a delay time setting - a (woman) friend of
mine said "yeah that's cool, but I can't see what's happening it's too
fast!" so you can set it to a couple of milliseconds delay between
trying the next iteration. Without delay, for tough puzzles it will
take between 2 and 5 minutes to figure out a solution. There is a
samples sheet that has some puzzles I found online, just copy/paste
those into the grid.

The code is quite simple, you can see it (all in the sudoku
worksheet). It's basically a single recursive function that does
everything, everything else is supplementary such as to check where
row/column/block each thing is located.

http://www.44lbs.net/ilia/061208sudoku_solver.xls

FYI, I have never solved a sudoku in my life.
It is possible to use Excel to solve Sudoku.
I used mainly Excel Functions and just a little VBA to make it work. I just
[quoted text clipped - 4 lines]
 
L

LynnI via OfficeKB.com

This is a very good program to fill the blanks. However, if there is an error
in the puzzle, the program got stuck and could not stop early enough.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top