Results 1 to 4 of 4

Thread: VBA Program to Compare Lists in 4 Columns in Excel

  1. #1

    VBA Program to Compare Lists in 4 Columns in Excel



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi all

    I am quite New to VBA programming in Excel. Can someone please help me how to create a VBA Program to Compare 4 Columns in Excel and store the output to a txt file. I have searched it in multiple websites but i couldn't find it. I have my data from column A to F. I have a program without using dictionary but it takes too long as there are ard 31k lines in the list 1 and 32k lines in list

    My data is in this format:

    Source Data Dump Data

    A B C D E F
    [1] file format(4char) address(6char) data(66char) file format(4char) address(6char) data(66char)


    1) If the first line (A2) or (D2) starts with "S011" or "S804" skip and read next line.

    2) If the address in Column B matches the address in Column E, check if the adjacent data linked to it is also a match ie. if B10 = E10, check if C10 = F10. If there is a mismatch in data output to txt file in this format:

    Source Data
    Address
    A10+B10+C10
    Dump Data
    Address
    D10+E10+F10
    Result: NOK

    3) If column B address is not found in Column E ,

    Output :
    Source Data
    Address
    A10+B10+C10
    Result: NOK

    4) If column E address is not found in Column B , check if the string of data in column F are all 'F's excluding the last 2 characters.
    if All F's then output OK
    if Not All F's then output NOK

    Output :
    Dump Data
    Address
    D10+E10+F10
    Result: NOK

    Thanks a lot!

  2. #2
    Conjurer snb's Avatar
    Join Date
    May 2013
    Posts
    376
    Articles
    0
    Excel Version
    2020
    It's always recommendable to start at the beginning; otherwise you won't even understand any sound advice.

    Excel VBA Programming For Dummies by John Walkenbach | 9781119077398 | Paperback | Barnes & Noble

  3. #3
    Hi snb, I have done 2 other tasks using excel VBA but those were not so complicated. I am not very comfortable using array and dictionary. If someone could tell how to integrate it into my code. It will we really helpful.


    My code: codeshare . io/ QMVCX
    Last edited by Manick9; 2016-09-08 at 10:41 AM.

  4. #4
    If you could attach a sample workbook (with less that 31K rows ) showing what you want, it would be easier for us to help.

Tags for this Thread

Posting Permissions

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