+ Reply to Thread
Results 1 to 10 of 10

Two words of 3 letters twice

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2013 PRO PLUS
    Posts
    3,695

    Two words of 3 letters twice

    I came across this word called

    LOGLOGS

    I need macro to scan dictionary and place such words at c1 downwards

    LOGIC , 3 letter word twice in the word , this means LOG was twice in the word

    If it pours correctly it will pull BULBULS others i forgot

    Find attached
    Attached Files Attached Files
    Last edited by makinmomb; 01-12-2024 at 09:51 AM. Reason: Title GRAMMAR

  2. #2
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Two words of 3 letters twice

    VBA code:
    Sub DoubleLetters()
    Dim A, T&, TC&, TD&, X&, W$
    A = Range("a1").CurrentRegion
    
    With CreateObject("Scripting.dictionary")
    For T = 1 To UBound(A, 1)
    W = A(T, 1)
     For TC = 1 To Len(W) - 5
        For TD = TC + 3 To Len(W) - 2
        If Mid(W, TC, 3) = Mid(W, TD, 3) Then
        .Add W, T
        GoTo Line1
        End If
        Next TD
     Next TC
    Line1:
    Next T
        Range("C1").CurrentRegion.Clear
        Range("C1").Resize(.Count, 1) = WorksheetFunction.Transpose(.Keys)
    End With
    End Sub
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  3. #3
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,466

    Re: Two words of 3 letters twice

    Here are solutions with a formula:

    Excel 2007 and newer:

    Please insert an empty row at the top and try in C2 and copy down (confirm the formula with Ctrl+Shift+Enter; response time after copy down about 20 seconds):
    Formula: copy to clipboard
    =INDEX(A$2:A$34255,MATCH(1,((MID(A$2:A$34255,1,3)=MID(A$2:A$34255,4,3))+(MID(A$2:A$34255,1,3)=MID(A$2:A$34255,5,3))+(MID(A$2:A$34255,2,3)=MID(A$2:A$34255,5,3))>0)*(COUNTIF(C$1:C1,A$2:A$34255)=0),0))


    Excel 2021 or 365:

    Please try in D2 (no copy down needed; response time within 1 second):
    Formula: copy to clipboard
    FILTER(A2:A34255,(MID(A2:A34255,1,3)=MID(A2:A34255,4,3))+(MID(A2:A34255,1,3)=MID(A2:A34255,5,3))+(MID(A2:A34255,2,3)=MID(A2:A34255,5,3)))
    Attached Files Attached Files
    Last edited by HansDouwe; 01-12-2024 at 11:18 AM.

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,768

    Re: Two words of 3 letters twice

    Another ("borrowed" some of KVS code

    Option Explicit
    
    Sub FindDoubleLetters()
    Dim A, T&, TC&, TD&, X&, W$, n$
    Dim xstr As String
    A = Range("a1").CurrentRegion
    ReDim b(1 To UBound(A, 1))
    n = 0
    For T = 1 To UBound(A, 1)
    W = A(T, 1)
     For TC = 1 To 2
        xstr = Mid(W, TC, 3)
        xstr = Replace(W, xstr, "")
        If Len(xstr) = 1 Then n = n + 1: b(n) = W: Exit For
     Next TC
    Next T
        Range("C1").CurrentRegion.Clear
        Range("C1").Resize(n, 1) = Application.Transpose(b)
    
    End Sub
    Attached Files Attached Files
    Last edited by JohnTopley; 01-12-2024 at 11:34 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,505

    Re: Two words of 3 letters twice

    A solution with Regular Expression

    Sub jec()
     Dim ar, j As Long, y As Long
     ar = Range("a1").CurrentRegion
     ReDim ary(UBound(ar), 0)
     
     With CreateObject("VBScript.RegExp")
       .Global = True
       .Pattern = "([A-Z]{3})(?=.*?\1.*$)"
        For j = 1 To UBound(ar)
           If .test(ar(j, 1)) Then
             ary(y, 0) = ar(j, 1)
             y = y + 1
           End If
        Next
        Range("G1").Resize(y) = ary
     End With
    End Sub

  6. #6
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2013 PRO PLUS
    Posts
    3,695

    Re: Two words of 3 letters twice

    Nice one hansdouwe that too without macro

  7. #7
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2013 PRO PLUS
    Posts
    3,695

    Re: Two words of 3 letters twice

    JT yours is correct through same results against formula , thank you

  8. #8
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2013 PRO PLUS
    Posts
    3,695

    Re: Two words of 3 letters twice

    JEC must be correct too , thank you all

  9. #9
    Forum Contributor
    Join Date
    01-04-2014
    Location
    East Africa
    MS-Off Ver
    MS OFFICE 2013 PRO PLUS
    Posts
    3,695

    Re: Two words of 3 letters twice

    KV nice if JT borrowed some codes from you

  10. #10
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,466

    Re: Two words of 3 letters twice

    You are Welcome! Thanks for the rep. with kindly rep. comment . Glad to have helped with a formula. .

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] replace short letters with another letters for each item into column
    By abdo meghari in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-04-2023, 07:24 AM
  2. [SOLVED] Grade book with varied weightings; letters to numbers to letters
    By mcgudo in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-30-2022, 04:07 AM
  3. Replies: 1
    Last Post: 12-23-2021, 07:25 AM
  4. [SOLVED] Not differentiating between capital letters and lower case letters
    By Eliot Y in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-22-2015, 11:13 AM
  5. Replies: 5
    Last Post: 12-30-2012, 10:59 AM
  6. add colour to particular wors in the cell
    By jacks89mathew in forum Excel General
    Replies: 1
    Last Post: 09-24-2012, 06:31 AM
  7. Find 2 Matches Wors Then Cut Selected Rows
    By bernardng in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2006, 01:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1