+ Reply to Thread
Results 1 to 4 of 4

Find differences in cell text strings

Hybrid View

  1. #1
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Find differences in cell text strings

    Good morning/afternoon,

    I think there is a way to do this with arrays, but I'm still pretty awful with them, so, hoping one of you can throw me an assist. Will try to explain here, but am also attaching a small sample of the data.

    I have pipe separated values in three columns. Each cell starts with a category and counter (e.g. Topic (8), meaning there are 8 topics listed in the remainder of the string) and can have any number of values (including none). Each value consists of only one word - there are no multi word values, ever.

    There will be anywhere from 5 to roughly 7,000 rows, though I've rarely seen files in excess of 250.

    I need to find every value that is in column B, that is not in column C, and is not already in column D. Those should be dumped out into column E, pipe separated if possible, or alternated, each value dumped into the first available column in the active row.

    THANK YOU FOR ANY HELP!!!!!!!!!!!!!!
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,977

    Re: Find differences in cell text strings

    Macro Check in Sheet1 module will do this, although this data may not be a comprehensive test. If you are not familiar with managing macros let me know if you need more detail for how to use it.
    Attached Files Attached Files
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    05-20-2015
    Location
    Chicago, Illinois
    MS-Off Ver
    2016
    Posts
    2,103

    Re: Find differences in cell text strings

    6String beat me in, but I came up with the following:

    
    Sub JPRomano()
    Dim Evalue As String
    Dim SplArray() As String
    Dim LastRow As Long
    
    LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Row
    For j = 1 To LastRow
        Evalue = ""
        SplArray = Split(Range("B" & j).Value & "|", "|")
        For i = LBound(SplArray) To UBound(SplArray) - 1
            If InStr(1, Range("C" & j).Value, SplArray(i)) = 0 And InStr(1, Range("D" & j).Value, SplArray(i)) = 0 Then
                Evalue = Evalue & "|" & SplArray(i)
            End If
        Next i
        Range("E" & j).Value = Mid(Evalue, 13, Len(Evalue) - 1)
    Next j
    End Sub
    If his works, it's probably better - mine doesn't add the "Topic" count to column E.

  4. #4
    Forum Contributor JP Romano's Avatar
    Join Date
    10-09-2008
    Location
    Princeton, NJ
    MS-Off Ver
    2010
    Posts
    500

    Re: Find differences in cell text strings

    These are both tremendous solutions, giving me the results I need. Thank you both for your time and help!

+ 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. Detecting differences between strings of text
    By Motox in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-01-2015, 12:50 AM
  2. Formula to find and return text string within a cell full of text strings
    By LightingPop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-03-2013, 11:45 PM
  3. Compare two strings and output the differences
    By aliastx in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-14-2013, 10:49 PM
  4. Compare Differences between 2 strings
    By wadafruck in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-11-2012, 07:09 PM
  5. Replies: 5
    Last Post: 04-28-2012, 01:54 AM
  6. Can You Output Differences Among Strings?
    By ilikeexcel in forum Excel General
    Replies: 3
    Last Post: 11-18-2011, 06:04 PM
  7. Finding differences in strings
    By tchezick in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-22-2005, 11:55 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