Word search help

wordsearch

New Member
Joined
Nov 24, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I'm trying to solve a 20x15 word search. It comes with no words to find. The clues are you may ignore all three letter words and some proper nouns. It also gives a clue to use excel.:)
 
Last edited by a moderator:

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Do you have a question?

I see no way to use Excel for something like this without a list of words.
 
Upvote 0
If you're willing to use VBA, you can try this. Open a new workbook. Enter your word search grid in the sheet, one letter per cell. (See below for example.) Then right click on the sheet tab, select View Code. Then press Alt-IM to Insert a Module. Then paste the following code in the window that opens:

VBA Code:
Sub WordSearch()
Dim puzzle As Object, Output As Object, grid As Variant, MaxCol As Long, MaxRow As Long
Dim dirs As Variant, dirx As Variant, diry As Variant
Dim r As Long, c As Long, d As Long, w As String, w2 As String
Dim resc As Long, i as long

    Set puzzle = Range("A1:O20")
    Set Output = Range("R1")
    grid = puzzle.Value
    
    MaxCol = UBound(grid, 2)
    MaxRow = UBound(grid)
    resc = 0
    Output.Resize(1000, 3).ClearContents
    Output.Resize(, 3) = Array("Word", "Start", "Direction")
    
    dirs = Array("N", "NE", "E", "SE", "S", "SW", "W", "NW")
    dirr = Array(-1, -1, 0, 1, 1, 1, 0, -1)
    dirc = Array(0, 1, 1, 1, 0, -1, -1, -1)

    For r = 1 To MaxRow
        For c = 1 To MaxCol
            Application.StatusBar = "Found: " & resc & "  Checking " & puzzle.Cells(r, c).Address(0, 0)
            For d = 0 To 7
                w = GetWord(grid, r, c, d, dirs, dirr, dirc)
                For i = 4 To Len(w)
                    w2 = Left(w, i)
                    If Application.CheckSpelling(w2) Then
                        resc = resc + 1
                        Output.Offset(resc) = w2
                        Output.Offset(resc, 1) = puzzle.Cells(r, c).Address(0, 0)
                        Output.Offset(resc, 2) = dirs(d)
                        DoEvents
                    End If
                Next i
            Next d
        Next c

    Next r
    
    Application.StatusBar = False
    If resc = 0 Then
        MsgBox "No words found"
        Exit Sub
    End If
    
End Sub

Function GetWord(ByRef grid, ByVal r, ByVal c, ByRef d, ByRef dirs, ByRef dirr, ByRef dirc)

    GetWord = ""
    
    While r <= UBound(grid) And c <= UBound(grid, 2) And r > 0 And c > 0
        GetWord = GetWord & LCase(grid(r, c))
        r = r + dirr(d)
        c = c + dirc(d)
    Wend
            
End Function

On the top 2 indented lines, put the range where you put the grid, and the location where you want the results. Return to the Excel window, press Alt-F8 to open the macro selector, and click on WordSearch. The routine is relatively slow, the CheckSpelling method is time consuming. If you had a list of potential words, we could replace that with a dictionary of the words and just use .Exists and it would go much faster. As it is, each row takes about 90 seconds, or 30 minutes for the whole thing. The status bar updates as it goes.

Consider this:

Book2
ABCDEFGHIJKLMNOPQRST
1XOVSEBPVPIPIANOWordStartDirection
2RJXXUSDLSIPAKWVployG1SE
3XRMAREWDOLHKEUBpipiI1E
4HRICDGQATYBJTATpianK1E
5PSCKMTJXLUDLLEVpianoK1E
6CDRMDJFAYATQKLFmareC3E
7HKONOWTVFPQTVQSmicroC3S
8YVPGPRKDNCNBCFXmicrophoneC3S
9BFHZMYBUSXXSAKEcropC5S
10BROSNJJAOGXHGCXlawsI5NW
11GRNQWOSANWFFDJJnowtD7E
12TGEJYFRXTAKGKNIphoneC8S
13LAYNBQZMUONNEHPhoneC9S
14LXZDPNJJOUSAGEWhoneyC9S
15OFHGFZISBCSRLBMbananaG9SE
16WAANOFRZLOKZRJDsakeL9E
17JUKRQUPKMNRCTEUbrosA10E
18EMPCBRCULFWQFHCsorbD10W
19GEUFAEXMTKCTJQAnormE10SE
20SADLUJZWAPYVUEWnanaI11SE
21analJ12SE
22muonH13E
23mockH13SE
24nanaK13NW
25usageJ14E
26sageK14E
27sookH15NE
28boutI15N
29bungI15NE
30confJ15S
31rangL15N
32deftO16SW
33errsN17NW
34bursE18NE
35jackF20NW
36zebraG20NW
Sheet1


The A1:O20 range is a set of random letters I created for testing. I put 4 real words in it to test with. As you can see, there were plenty of other words found, some were just lucky creations from the random letters, some were odd words that exist in Excel's dictionary.

I don't believe you can do this with formulas, since CheckSpelling isn't available to formulas. If you had a word list, maybe. Anyway, hope this helps!
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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