+ Reply to Thread
Results 1 to 3 of 3

Macro to compare the data between 2 files and generate the count

  1. #1
    Forum Contributor
    Join Date
    08-12-2013
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    147

    Macro to compare the data between 2 files and generate the count

    Hello Guys,

    I need help in creating a Macro which compare the Customer ID’s present in Column H of Sample1 file with Column B of both Sample1 and Sample2 files.

    The Count of Sample1 file should come in Column I and the count of Sample2 file should come in Column J of Sample1 file.

    After above steps macro should automatically pick the lowest value (value should be greater than 0, if value is 0 than macro should consider it as blank) from Column I and J and paste it to Column K.

    For more clarification please refer the attached sample files.

    In Sample1 file I had also shown that how the data should look after running the Macro.

    Thanks,
    MG
    Attached Files Attached Files
    Last edited by Manish_Gupta; 05-15-2014 at 12:18 AM.

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Macro to compare the data between 2 files and generate the count

    Hello Manish, The same can be achieved with formula solution also take a look
    in I2 copy paste below
    =IF(H2="","",COUNTIF($B$2:$B$8,H2))

    in J2 copy paste below
    =IF(I2="","",COUNTIF([Sample2.xlsx]Sheet1!$B$2:$B$6,H2))

    *change the range criteria according to your actual data

    in K2 copy paste below then hold control and shift together and hit enter and release all three keys
    =IF(H2="","",MIN(IF(I2:J2>0,I2:J2)))

    drag all the formulas down.

    select I2 to K8 go to conditional formatting ---> select new rule--> add a formula---> type =len($K2)>0
    in format select yellow color.
    Attached Files Attached Files
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Forum Contributor
    Join Date
    08-12-2013
    Location
    India
    MS-Off Ver
    Office 365
    Posts
    147

    Re: Macro to compare the data between 2 files and generate the count

    Hello hemesh,

    Thanks for reply.

    Formula option is good but i need only a Macro. If you can add the formulas in a Macro then it will also work for me.

    Thanks,
    MG

+ 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. Macro to generate auto daily files with todays Birthday
    By dingdang in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2013, 11:34 PM
  2. Macro to generate list of files in a hard drive with hyperlinks
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2012, 04:13 PM
  3. Macro to generate PDF's instead generates Excel files
    By ShamusVW in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-11-2010, 01:01 PM
  4. vba script to generate files based on an data from an Excel sheet
    By bananas in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-30-2007, 03:00 PM
  5. [SOLVED] Compare worksheets and generate list of missing data?
    By Minuette in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-03-2005, 09:45 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