+ Reply to Thread
Results 1 to 5 of 5

VB Code to compare 2 columns of data

  1. #1
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    VB Code to compare 2 columns of data

    Hello:

    Please refer to attached file.
    I have date in Column A and check # in Column B.
    I need VB Code to go thru the data and do the following:
    Compare the check# with the date.
    I need a unique check number for a given date.
    Looking at the attached file, i have highlighted yellow.
    Here i have Check # 2947 for 6/1/2016.
    Now i see Check # 2947 for 6/15/2016.
    SO in this case i need to add 1 at the end of check # for 6/15/2016.
    So the yellow highlighted field would become "29471"
    I have other data down the list the same issue.
    I hope this is clear what i am trying to accomplish

    Let me know if you have any questions.
    Thanks.

    Riz
    Attached Files Attached Files

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VB Code to compare 2 columns of data

    What if #2947 occurs on more than two dates?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert Crooza's Avatar
    Join Date
    10-19-2013
    Location
    Hunter Valley, Australia
    MS-Off Ver
    Excel 2003 /7/10
    Posts
    2,082

    Re: VB Code to compare 2 columns of data

    I assumed there is only the possibility of having a check on two days (ie so there is only the need to add a 1 and not a 2,3,4 ....)

    If this assumption is wrong then the following code will need some tweaking to keep track of the different dates and the number to add to the check number.

    Please Login or Register  to view this content.
    Happy with my advice? Click on the * reputation button below

  4. #4
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to compare 2 columns of data

    Hello JB and Crooza:

    If check # occurs more then 2 dates then add "2", "3" and so on at the end of the check.
    Please let me know if you have any questions.
    Thanks.

    Riz

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VB Code to compare 2 columns of data

    Try this
    Please Login or Register  to view this content.

+ 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. Compare columns edit VBA code
    By Hikaru12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2015, 06:05 PM
  2. Need VBA Code to compare Values in two columns
    By Karthik Sen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2014, 05:20 PM
  3. VBA Code to Compare Two Worksheets and display the columns with changes.
    By mrbhide in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 12:33 AM
  4. VBA Code - Compare Adjacent Cells In two columns...
    By mtt23 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-13-2012, 05:47 AM
  5. VBA - Code to compare 2 columns
    By Swiss Cheese in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 08-08-2012, 05:26 AM
  6. Help with VB code to compare two columns
    By Farooq Sheri in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2006, 07:20 AM
  7. How do I write a VBA code in excel that will compare two columns .
    By PenelopeinCinci in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-14-2005, 01: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