+ Reply to Thread
Results 1 to 6 of 6

Compare each column with next others

  1. #1
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Compare each column with next others

    Hello gurus,

    I have data table with 30 columns, each column has sequence number 1,2,...29, 30.
    Column number in row 13,
    Concat of each column in row 14

    Please help to create macro which will compare CONCAT of column 1 with CONCAT of column 2, then 3, ... until 30
    next iteration compare CONCAT of column 2 with CONCAT of column 3, CONCAT of column 4,... until 30.

    In case of match just wrote below text for example "1 equal 25"

    Appriciated for any input, thx a lot!
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Compare each column with next others

    It will write from cell A15 down:
    PHP Code: 
    Sub test()
    For 
    1 To 29
        
    For 1 To 30
        
    If Cells(14i) = Cells(14jThen
            k 
    1
            Cells
    (141).Value " equals " j
        End 
    If
        
    Next
    Next
    End Sub 
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: Compare each column with next others

    perfect, it works thx a lot!

  4. #4
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: Compare each column with next others

    Hello My friend,

    I made small macro, but have big problem, i have repeats column X equal to column Y, but it contain only 0, but i don't needed it. Could you help plz to skip it in the loop?! Table template is attached. Thank you in advance!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    01-25-2011
    Location
    Belgium, Alveringem
    MS-Off Ver
    Excel 2003, 2007, 365
    Posts
    1,418

    Re: Compare each column with next others

    some small changes, focus on the red parts !
    snull is a string with x characters "0" with x = lrow-frow

    Please Login or Register  to view this content.
    Last edited by bsalv; 11-26-2021 at 06:12 PM.
    Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

  6. #6
    Forum Contributor
    Join Date
    12-24-2016
    Location
    London
    MS-Off Ver
    2013
    Posts
    153

    Re: Compare each column with next others

    Magic function, thx a lot! everything works well.

+ 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] Formula to compare column duplicates in a column & second column with dates
    By lancelotlink in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 01-15-2022, 05:38 PM
  2. Replies: 3
    Last Post: 02-06-2020, 04:37 PM
  3. Compare two sheets column by column and insert an empty column with a header
    By MCGOM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2019, 04:07 AM
  4. [SOLVED] Formula to compare column 1 to column 2 and list items not in column 2.
    By mahalek1976 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-23-2016, 12:55 PM
  5. Compare multiple columns (column A,column B,Column C) and return value (Column D)
    By john008 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-21-2015, 08:24 AM
  6. [SOLVED] Compare two names list and compare other column aftrerwards
    By badboynads in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-25-2013, 12:46 PM
  7. How to Compare Column 12 to values in column 6 while deleting dups from column 12
    By Launchnet in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 12-16-2011, 03:21 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