Sudoku checker

rokkusar

New Member
Joined
Jan 15, 2022
Messages
1
Office Version
  1. 2021
Platform
  1. Windows
Hello,
So i have to make a code that checks if the sudoku written in excel is correct.
I would really appriciate your help
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Are you wanting something to just check the values of each row and column? Something like this? I added some conditional formatting just to make it stand out. If you want something that will actually solve it, check this link out. Sudoku Solver in Excel

Book3
ABCDEFGHIJKL
1
2831679528BAD
3967258341OK
4582143967OK
5659817234OK
6328564179OK
7714932856OK
8873421695OK
9145396782OK
10296785413OK
11
12BADOKOKOKOKOKOKOKOK
Sheet1
Cell Formulas
RangeFormula
L2:L10L2=IF(SUM(B2:J2)=45,"OK", "BAD")
B12:J12B12=IF(SUM(B2:B10)=45,"OK", "BAD")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B12:J12,L2:L10Cell Value="BAD"textNO
B12:J12,L2:L10Cell Value="OK"textNO
 
Upvote 0
If you’re trying to check a Sudoku puzzle in Excel, you could create a simple code to make sure each row, column, and 3x3 grid has the right numbers.
 
Upvote 0
Here is a formula that checks if a sudoku is correctly solved:
Would this work for you?

Book2.xlsx
ABCDEFGHIJKLM
1
2387491625TRUE
3241568379
4569327418
5758619234
6123784596
7496253187
8934176852
9675832941
10812945763
11
Sheet2
Cell Formulas
RangeFormula
L2L2=LET( a, {1;2;3;4;5;6;7;8;9}, osv, {0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,0,3,6,0,3,6,0,3,6;0,1,2,3,4,5,6,7,8,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,6,6,6;9,9,9,9,9,9,9,9,9,1,1,1,1,1,1,1,1,1,3,3,3,3,3,3,3,3,3;1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,3,3,3,3,3,3,3,3,3}, SUM(BYCOL(osv, LAMBDA(x, (SUM((SORT(TOCOL(OFFSET($B$2, INDEX(x, 1, 1), INDEX(x, 2, 1), INDEX(x, 3, 1), INDEX(x, 4,1))))=a)*1)=9)*1 )))=27 )
 
Upvote 0

Forum statistics

Threads
1,221,519
Messages
6,160,282
Members
451,635
Latest member
nithchun

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top