sudoku

W

Wim Rijsdijk

Hello,

I am trying to make an Excel-spreadsheet, based on Sudoku puzzle.

So , cells a1 to i1 have to be filled with the numbers 1 to 9, in random
order.


a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s

1


4


6




1
2
3

5

7
8
9

2

1

2
5
9

4
6



3



7
8


3








7

1
2
3
4
5
6

8
9

4


1
3
9


7
2




4
5
6

8


5

3


7


5


1
2

4

6

8
9

6
9
7


4





1
2
3

5
6

8


7
8
9


2

6

4

1

3

5

7



8
1
2

4
6
7

8




3

5



9

9



9
8





1
2
3
4
5
6
7





As you see, a1 to i1 is only filled with 4 and 6.
In columns k to s you can see which numbers are not used, so in this example
in row 1, it is 1,2,3,5,7,8,9

The problem is, I want a formula to put on k1, with the following needs:
- check for a1 to i1 if number 1 is on it. In this example NO.
- if NO, then on k1 the number 1 has to appear
- it YES, then on k1 the number 1 has to disappear.

if((b1:j1)=1;" ";"1") is not working. What is the solution ?!?!?!?

If I have 1 formula, I can fill the other cells.

Thanks in advance, for helping me.

Greets,
Wim Rijsdijk
 
W

Wim Rijsdijk

forget this one, I made a new message, without Excel-sheet
!!!!!!!!!!!!!!!!!!!!!!!!
 
K

keepITcool

there's a sodoku solver
from Andy Pope...

and I've made my own...

a bit quicker AND in most cases manages
to solve 4x4 puzzles too...

mail me if interested.




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Wim Rijsdijk wrote :
 
H

Henry

Wim,

Are you trying to make a Sudoku puzzle or to solve one?

Either way, put the numbers 1 to 9 in a string (in any order)
If the number is already used, take it out of the string.
Then choose a random position from the string
MyNum = Rand *Len(string)

Mid(string,MyNum,1)

Do your checks to see if that number is possible in that position, if it is
then use the number.

Now that the number has been used, take it out of the string

String = Left(string,Mynum-1) & Right(string,Len(string)-Mynum).

You are now left with the remaining, unused numbers to select from.

Henry
 

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

Similar Threads

Arriving at totals 2
Paragraph numbering in Word 1
Gears 14
Removing Sequential Numbers 5
Finding the right style field in VBA 0
Move cells down 0
Creating Different Headers in Word 0
Move cells down 2

Top