Results 1 to 6 of 6

2 column compare that maintains data sequence but shifts cells to align rows

Threaded View

  1. #1
    Registered User
    Join Date
    10-13-2008
    Location
    Ireland
    Posts
    14

    2 column compare that maintains data sequence but shifts cells to align rows

    I'm trying to write a macro that will compare and align 2 columns of data as part of an overall marco but iend up doing it manually.

    I've included a simplified version that if i could work on it I could extrapolate to my file. In words this is what I'm trying to do:

    Compare cell A2 to Cell C2:
    If cell A2 = C2, move down to cell A3
    If cell A2 does not equal C2, search for cell A2 in column C below C2 (this is needed when you go further down the sheet which you will see later). If it does not exist, insert cell on C2+D2 and shift everything down in these columns from row 2 down. (this is implying this cell is unique to Col A)
    If cell A2 does not equal C2 and does not exist in column C, insert cell in A2+B2 and shift everything down in these 2 columns below row 2 (This is implying cell C2 is unique to Col C and is not in col A)

    The macro will continue to work its way down until the end of Col A following the above rules.

    One thing i need to maintain is the sequence of numbers in each column, its really important. I've included this in the example, even though some of the rows exist in both columns they are not in the right order.

    As a final note I'd like to highlight cells that are different betweent he 2 compare columns (i.e. A and C in the example). This isn't critical as I can just do a conditional format that shows all blank cells in a column and the neighbouring cell will be the one of interest, but it would be a nice way of closing it.

    Brendan
    Attached Files Attached Files
    Last edited by murphybrendan; 11-15-2013 at 08:23 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Align Rows - Compare Columns (Issue with shg's alignkeys macro)
    By Massael in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 10-22-2013, 08:40 PM
  2. compare and align data
    By scriblesvurt in forum Excel General
    Replies: 1
    Last Post: 03-19-2007, 01:27 PM
  3. [SOLVED] Compare and align rows of multiple but differing columns of data
    By e abor in forum Excel General
    Replies: 0
    Last Post: 06-06-2006, 12:10 PM
  4. Macro to align & compare multiple columns with several rows
    By Manav Ram via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2005, 04:10 PM
  5. Macro to align and compare multiple rows and columns
    By Manav Ram via OfficeKB.com in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-04-2005, 09:06 PM

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