+ Reply to Thread
Results 1 to 9 of 9

Copy values from one file to another file but copy when date and name match

  1. #1
    Forum Contributor
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2010
    Posts
    427

    Copy values from one file to another file but copy when date and name match

    There is two file attached one name is karanja and second file name is plusminus look in to the file karanja in cell O49 i apply yellow color so you can easily understand so in cell O49 date is 02/01/21 then in file plusminus
    firstly find name karanja which is in N column then in N column find date 02/01/21 then look in to file karanja there is cell W51 in that cell number is 17 that is positive number so copy that number in file plusminus where is name karanja which is in N column where is date 02/01/21 but paste that number in the column which had heading is Minus that is column P then we go to next date in file karanja we can see date 04/01/21 be remember we always took date from bottom in every data block that is the reason i apply yellow colour to that specific date so now we reach to date 04/01/21 which is in cell O81 and see the value of cell W83 which is negative number
    so put that 68 number in file plusminus where is date 04/01/21 but paste that number in column which had heading name plus because it is negative number so we paste that number in plus column it means O column then also copy number 2341 which is in cell N81 in file karanja then paste that number in file plusminus in column M near that date then go to next date and so on etcetera so please give me VBA code for above process
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy values from one file to another file but copy when date and name match

    With both files in same folder and extra data in Column O

    Please Login or Register  to view this content.
    Kind regards
    Leo
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2010
    Posts
    427

    Re: Copy values from one file to another file but copy when date and name match

    can you also copy values of N column from karanja file for example in karanja file in cell N49 value is 2296 copy that value in file plusminus near date 02/01/21 in column M of plusminus file and so on etcetra ,
    please check attachment file
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy values from one file to another file but copy when date and name match

    Try

    Please Login or Register  to view this content.
    Kind regards
    Leo

  5. #5
    Forum Contributor
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2010
    Posts
    427

    Re: Copy values from one file to another file but copy when date and name match

    also please do one more modification in that VBA code look in karanja file in cell O253 and cell O273 there is same date but
    in cell W255 there is positive number and cell W275 there is negative number , negative number is greater
    than positive number so minus small number from big number it means minus 16 from 91 and result is 75
    paste that 75 in plusminus file in column which had plus heading do same thing if positive number is greater than
    negative number then minus negative number from positive number and which is the result paste that result value
    in column which had heading minus , if both are positive numbers then do sum of both numbers also both are negative numbers then do sum of both numbers,
    please check attachment so you can easily understand
    Attached Files Attached Files
    Last edited by keshavtale; 04-19-2021 at 05:04 AM.

  6. #6
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy values from one file to another file but copy when date and name match

    What if both values are positive ?
    What if both values are negative ?
    What if there are more than 2 dates ?
    and last witch MRN No to sheet plusminus ?

    and maybe you dont know but negative number can never be greater than positive number

  7. #7
    Forum Contributor
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2010
    Posts
    427

    Re: Copy values from one file to another file but copy when date and name match

    if both values are positive then do sum of both values and paste that values in plusminus sheet where is column heading minus if both values is negative then do sum of that values and paste sum result in plusminus sheet where is column heading plus, it is not possible that more than 2 same dates, and about MRN NO take only one MRN No which is came first , and i know negative number can never be greater than positive but for example -194 this negative number in one cell and 36 number in another cell first convert this -194 in to positive number like 194 then minus 36 from 194 like this 194-36=158 then paste this 158 number in plusminus sheet where is heading plus

  8. #8
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Copy values from one file to another file but copy when date and name match

    Please Login or Register  to view this content.
    Kind regards
    Leo

  9. #9
    Forum Contributor
    Join Date
    03-13-2013
    Location
    india
    MS-Off Ver
    excel 2010
    Posts
    427

    Re: Copy values from one file to another file but copy when date and name match

    thanks now your code become perfect, now my problem is perfectly resolved,
    also you are the person with quick grasping power
    Last edited by keshavtale; 04-20-2021 at 03:06 AM.

+ 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. Replies: 0
    Last Post: 09-16-2020, 04:42 AM
  2. [SOLVED] File dialog box to open a excel file then copy data close file
    By mmikem in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2019, 09:57 AM
  3. Look up array in target file, then copy corresponding values back in start file
    By MrMyagiii in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-01-2018, 05:39 AM
  4. Copy data from txt file to excel file then delete text file
    By gratedane8 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-11-2018, 07:36 PM
  5. Open File With file name has format date and time and copy sheets in it
    By stryka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2015, 06:01 AM
  6. Select file and copy values from SharePoint excel file
    By peetman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-17-2014, 06:26 AM
  7. Open 2nd file(CSV) from cell reference, copy columns to main file & close 2nd file
    By Langchop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2013, 05:09 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