+ Reply to Thread
Results 1 to 12 of 12

Comparing & Mark different columns in excel VBA please

  1. #1
    Registered User
    Join Date
    06-15-2022
    Location
    bengladesh
    MS-Off Ver
    2016
    Posts
    26

    Comparing & Mark different columns in excel VBA please

    Hello all

    I need your exert advice in this regard, each day I am getiing 3 files ( 1 main file and 2 checking files) we just need to compare it against the main file, are you able to help me in this regard.

    Compare String is Amount + Date (date HH:MM) but in my second sheet time is 30 minutes more than main sheet. So we need to less 30 minutes when comparing with main sheet

    When Checking please Ignore Seconds

    Second Sheet and Third Sheet are individual files

    Main sheet contains all the data from second and third sheets, if it matches please mark it (orange & Green color)

    Please see attached excel file, thank you, this will help my time immensely and I am getting old these days too
    Attached Files Attached Files
    Last edited by tempo1; 11-20-2022 at 12:52 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Comparing & Mark different columns in excel VBA please

    Hi tempo,

    I think you need to convert all of your times using MRound to the nearest minute. You also need to make the middle table's dates, real dates instead of strings of text. I've added 3 helping columns to do the conversions. THEN I used conditional formatting to show Duplicates which I think is what you want. See the attached and ask questions if needed.
    MRound Compare and Conditional Format Dups.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: Comparing & Mark different columns in excel VBA please

    This macro for this sheet . That is all the three data should be in the same sheet.
    Column D was Text format. I have changed it to data format.
    Colum D is higher by 30mints compared to Column A. But you have written opposite to that in file.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Registered User
    Join Date
    06-15-2022
    Location
    bengladesh
    MS-Off Ver
    2016
    Posts
    26

    Re: Comparing & Mark different columns in excel VBA please

    Really appreciated your help, I will check it and let you know about it, Thank you very much sir

  5. #5
    Registered User
    Join Date
    06-15-2022
    Location
    bengladesh
    MS-Off Ver
    2016
    Posts
    26

    Re: Comparing & Mark different columns in excel VBA please

    Thank you sir, but need some correction as some of the data is missing to compare, please see uploaded spreadsheet. Is it possible to highlight the Main sheet with same color as well-like green with green , orange with orange.

    Sorry I didn't mentioned it earlier.

    Thanks again
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: Comparing & Mark different columns in excel VBA please

    Modified code
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 11-20-2022 at 10:06 AM.

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: Comparing & Mark different columns in excel VBA please

    Slightly made faster.
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, try this !


    According to the post #5 attachment an Excel basics VBA demonstration for starters :
    Please Login or Register  to view this content.
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 11-20-2022 at 11:02 AM. Reason: forum characters issue ...

  9. #9
    Registered User
    Join Date
    06-15-2022
    Location
    bengladesh
    MS-Off Ver
    2016
    Posts
    26

    Re: Comparing & Mark different columns in excel VBA please

    Quote Originally Posted by kvsrinivasamurthy View Post
    Slightly made faster.
    Please Login or Register  to view this content.
    Thank you Murthy sir, this solved my problem, all the best

  10. #10
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: Comparing & Mark different columns in excel VBA please

    Welcome. Pl mark the thread solved.

  11. #11
    Registered User
    Join Date
    06-15-2022
    Location
    bengladesh
    MS-Off Ver
    2016
    Posts
    26

    Re: Comparing & Mark different columns in excel VBA please

    Sorry I got an error when a fresh data copied to the spreadsheet, (Run time error-Type Mismatch Error). I think it is related to the data in D & E columns, please see attached and fix it, thank you
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,600

    Re: Comparing & Mark different columns in excel VBA please

    Data in D column is text format. This already told in Post #3.

    How to find column data is text?
    Select data
    Home->In Number select for drop down
    Then you see in Number and in Short Date same text appears.

    Change data in D column to date.
    Select the column D data.
    Data -> Text to columns ->Delimited->Next-> Next -> select Date -> Finish.

+ 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. Comparing Two Columns in Excel VBA
    By chetanhm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-17-2020, 07:01 AM
  2. [SOLVED] comparing columns and mark difference
    By Armand0 in forum Excel General
    Replies: 11
    Last Post: 10-30-2013, 08:53 AM
  3. Comparing columns between two excel sheets
    By chrismatt83 in forum Excel General
    Replies: 4
    Last Post: 10-22-2013, 05:28 PM
  4. logic for Comparing columns in excel
    By sathyaanil37 in forum Excel General
    Replies: 1
    Last Post: 07-24-2013, 08:47 AM
  5. Comparing Two Columns in Excel Row By Row?
    By alulla in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2013, 01:39 AM
  6. [SOLVED] Comparing and mark data from two different worksheet
    By pyol17 in forum Excel General
    Replies: 10
    Last Post: 07-10-2012, 07:48 AM
  7. Comparing Two Columns, Excel Not Working
    By icepirates in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-02-2010, 02:31 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