Kakuro Spreadsheet

Maybe you found this page already knowing what Kakuro (also known, I gather, as Kakro or Cross Sums) is, or maybe you found it via my Sudoku spreadsheet page. Kakuro is a puzzle not entirely unlike Sudoku, in which numbers 1 to 9 must be placed in the empty squares of the grid. Like Sudoku, no two numbers the same may be placed in the same line. However Kakuro rather than a standard 9x9 grid, Kakuro uses a "crossword-like" grid, where a line is what would be a word in the crossword. In particular two lines can be in the same row or column if separated by a gap in the grid, and the same number can be in each of these lines. The final information needed is that the sum total of each line is given. This may range from 3 for a line of length 2 to 45 for a line of length 9. Unlike Sudoku, it is not usual to provide some "seeded" numbers in the grid.

What's presented here is an Excel spreadsheet which may be used to play with Kakuro problems. Some of the principles are similar to my Sudoku spreadsheet, in particular that it doesn't "solve" the problem all at once, but provides levels of hints and some known numbers that can be added to the grid either if you are stuck, or to do the possibly simpler parts at the beginning of a problem, however you want to use it.

However a Kakuro spreadsheet presents a problem that Sudoku doesn't have, every Kakuro problem is different in the arrangement of the grid and the line sums. In fact the grids aren't even all of the same size. So rather than a single spreadsheet, this is a "kit" spreadsheet composed of a number of components.

The first component is the first sheet 'Kakuro'. This is where you compose the problem. An example is given. To make up a new problem you rebuild this, arranging copies of the 2x2 cells with the red dividing line and sum values (row sum top right, column sim bottom left). Note that you should use copies of the cells given, not make your own, as they have a some hidden features. As in the example, all lines must be terminated by such a 2x2 cell, with no values if not needed at the right and below. The empty cells in the problem should use copies of those in the example, as they have suitable formatting, although the only essential detail is the merging of 2x2 cells into one. Outside the grid, merging of 2x2 cells is not necessary. I have done it here for two reasons, one is simply improved presentation, the second is that I have done it over the default "active area" of the spreadsheet, described below.

There is one special case, the first cell of the 'Kakuro' sheet provides error reporting. It should not be changed. (If deleted there is no harmful effect other than not being warned of errors, but copying this cell elsewhere will cause problems.) If an error is detected this cell will show ERROR in red. Possible errors are impossible lines (too many cells, too high or too low a total) and overall row and column sums not matching) and some impossible values entered.

It can happen, while building the first sheet that you "break" it and cause an invalid reference elsewhere in the spreadsheet. This may be indicated by an error indication (not "ERROR") in the first cell. In this case the best solution is to undo the last change. In the last resort you may have to rebuild the "active area" of other sheets. To avoid this it is best to put the right hand side and bottom terminating cells in place first.

The "active area" of the spreadsheet is defined by all of the other sheets except the last "table" sheets 'Table' and 'Table1' to 'Table9' (which should not be touched in any way). All the other (non-table) sheets have all cells containing the same formula and formatting over the active area. If you want a larger active area simply take cell A1 (or any other cell in the active area) and copy over all of the new, rectangular, active area. (You can also reduce the active area by deleting rows and columns, or any other appropriate mechanism, but this should usually not be necessary.) You must ensure that all sheets have the same active area, and that the problem does not extend over a greater area (allowing for that a 2x2 cell in the 'Kakuro' sheet corresponds to a single cell on the other sheets).

Having done this, the spreadsheet offers four levels of "hints" and "results". On the hints sheets, a cell shows the possible numbers that may appear in that cell (red numbers are those already entered on the problem sheet). The 'Hints2' sheet narrows the range of possible numbers in the 'Hints1' sheet by use of additional rules of deduction, and so on for the 'Hints3' and 'Hints4' sheets. Note that on these sheets, "789" means that this cell may be 7, 8, or 9. Rather than using "123456789", the word "Any" is used. If no number is possible "None" is shown, in red, which indicates that an error has been made in filling in the problem - or constructing it.

The four results sheets are based on the corresponding hints sheets, and where a single value appears in the hints sheet, or can be deduced from it by being the only possibility in one of the two lines the cell is in, this is shown in red. Already entered numbers are shown in black, cells which cannot be deduced as "x" signs. Note that any deductions from the hints sheets, or answers from the results sheets, must be copied to the problem sheet by hand. Note that using the lower level of hints or results (or hints rather then results when there are results) is not advantageous, but may be your preference when you, for example, just want a helping hand, not a complete solution. There is however no guarantee that the problem can be solved even using 'Results4', however even if the problem "sticks" at some point then 'Hints4' (or a lower hints sheet) should help, if you want it to.

The given example (a replacement for that in the previous version of this spreadsheet) cannot be completed even using the 'Result3' sheet (very few cells can be solved in fact)) but can be completed using the 'Results4' sheet.

As an outline, the 'Hints1' and 'Results1' sheets are based on two steps. First is that, for example, two cells adding up to 6 must each be either 1, 2, 4 or 5. This is applied both to all cells in a line, or all incomplete cells in a line (regardless of the completed cell values). Second is that, for example, if three cells add up to 9 and one is a 2 then the other two must each be either 1, 3, 4 or 6 (but not a 5, which the first step in either manner would include, or of course a 2). Each step is applied to both rows and columns, and combined. The logic for the first step is embodied in the sheet 'Table', for the second step in 'Table1' to 'Table9'. As far as this spreadsheet is concerned, these ten sheets are simply fixed tables (note that 'Table' uses "positive" logic, 'Table1' to 'Table9' use "negative" logic). However I do have a separate spreadsheet that calculates them. In principle this approach could be extended to handling the 36 cases of each possible pair of used values, but this would not be reasonable, let alone further cases. (There will also be diminishing returns at each step.)

The 'Hints2' and 'Results2' sheets are based on an additional step, considering only lines with two unfilled cells. For example if the sum of two cells is 5 and they have possible values indicated (in 'Hints1') by 13 and 134 then because the latter cannot be 2 the former cannot be 3. Using similar logic these possibilities will be reduced to 1 and 4. In other cases there may be a reduction, but not to single digits.

The 'Hints3' and 'Results3' sheets identify values whose values can be fixed based on unique occurrences in a line. For example if three cells in a line may have possible values indicated (in 'Hints2') by 12, 12 and 126. Clearly the third cell must be 6 because only three possible values are included for three cells, and only the third cell can be 6.

The 'Hints4' and 'Results4' sheets identify values whose values can be fixed based on minimum and maximum possible sums in a line. The simplest such example is that possible values indicated (in 'Hints3') are 123, 689 and 789 and the sum is 14, then the cells must be 1, 6 and 7. More complicated cases can be handled, for example if the possible values are 123, 123 and 789 then the minimum sum is 10, not 9. The sheet deduces this from the repeated 1, but cannot deduce that the minimum sum is 11, not 10, in the case 134, 134 and 789. (This does not produce false deductions, only failures to make deductions.) However it can deduce that in the case of 123, 245 and 789, with minimum sum 10, if the actual sum is 11 the second value can still be deduced to be 2, because the "margin" between 2 and 4 is greater than that between 10 and 11. Maxima are treated similarly.

Note that in principle there is no reason why the third and fourth set of hints and results are in that order, but as both produce actual solutions that can be fed back to the 'Kakuro' sheet, the order is not important, and has been selected based on which is more "difficult".

When filling results back into the 'Kakuro' sheet, this can be done all at once, one at a time, or anything in between. I think it does not make any difference to the solubility of the problems, but (unlike my Sudoku spreadsheet) I have not rigorously proved this, but believe it to be true.

Please send any feedback (especially any faults you find - of course I hope there aren't any, but I definitely can't be sure of that) to: chris@mnemosyne.demon.co.uk

Return to home page

Last modified: 25th June 2006 (added two new sets of hints and results).