+ Reply to Thread
Results 1 to 6 of 6

Extracting data from separate worksheets into new worksheet

  1. #1
    Registered User
    Join Date
    06-03-2018
    Location
    Thailand
    MS-Off Ver
    2016
    Posts
    30

    Extracting data from separate worksheets into new worksheet

    I need a vba code to ease my work.

    Background: I have expense report in Sheet 1 with duplicate names and raw data in Sheet 2. What I want the data to be populated in Sheet 3 are:

    Employee name - to be extracted from Sheet 2
    Total amount - from Sheet 1
    The rest of columns in Sheet 3 to be extracted from Sheet 2

    I attached the workbook for easy reference.

    Thank you in advance!
    Attached Files Attached Files

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Extracting data from separate worksheets into new worksheet

    You can do this with formulas as well:
    Sheet 3 - A2 and down: =IFERROR(INDEX(Sheet2!$C$2:$C$17,MATCH(0,INDEX(COUNTIF($A$1:A1,Sheet2!$C$2:$C$17),0,0),0)),"")
    B2 and down: =IF(A2<>"",SUMPRODUCT((ISNUMBER(SEARCH(Sheet3!$A2,Sheet1!$E$6:$E$18)))*Sheet1!$G$6:$G$18),"")
    C2 and down: =IFERROR(INDEX(Sheet2!$B$2:$B$17,MATCH(Sheet3!$A2,Sheet2!$C$2:$C$17,0)),"")
    D2,E2,F2 and down: VLOOKUPS wrapped in IFERRORs
    Click the * to say thanks.

  3. #3
    Registered User
    Join Date
    06-03-2018
    Location
    Thailand
    MS-Off Ver
    2016
    Posts
    30

    Re: Extracting data from separate worksheets into new worksheet

    Hello PaulM100,

    How can I change the formula if I need the name in Sheet 1 to be populated in Sheet 3?

    Thank you.

  4. #4
    Registered User
    Join Date
    06-03-2018
    Location
    Thailand
    MS-Off Ver
    2016
    Posts
    30

    Re: Extracting data from separate worksheets into new worksheet

    To be specific, the name to be populated in Sheet 3 are extracted from Sheet 2 based on the ID number. For example, the name "Janice" in Sheet 1 does not match the name in Sheet 2. Therefore, would like to use the ID number to identify the name.

  5. #5
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Extracting data from separate worksheets into new worksheet

    I am not sure if this is what you want, but modify the formula from above for B2 into: =IF(A2<>"",SUMPRODUCT((ISNUMBER(SEARCH(Sheet3!$C2,Sheet1!$E$6:$E$18)))*Sheet1!$G$6:$G$18),"")
    Ad you can add a new column to return the name found in sheet1(it is a bit long, and I am sure that there may be a easier way, but this will do the job as well:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-03-2018
    Location
    Thailand
    MS-Off Ver
    2016
    Posts
    30

    Re: Extracting data from separate worksheets into new worksheet

    Thank you again PaulM100.

    The formula is a bit too long It will create problem if someone in the office uses this file and did not copy the formula correctly. I would prefer a macro to do this job. The extract result that I want as below:

    Employee Name Total Amount Employee ID Bank A/c No. File No.
    Loh Ming Yee 236.00 8192 PBB 490855 2335477
    Ung Ngee Huat 65.30 7309 PBB 496714 523612

    Sorry, I do not know how to reattach the file.

+ 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. [SOLVED] Extracting data from separate worksheets into new worksheet
    By Espilano in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-16-2018, 02:18 PM
  2. Need to extract data from multiple worksheets and place in a separate worksheet
    By chuck_p in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-03-2014, 01:56 PM
  3. Get Master Worksheet to Separate Data into Various Worksheets
    By NewbieOfVBA in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-18-2014, 04:30 PM
  4. Macro to Copy data from two separate worksheets and combine into a third worksheet
    By Excel-RZ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2013, 07:12 AM
  5. Extracting data from many worksheets into one worksheet within the same workbook
    By MUNECA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2013, 02:27 AM
  6. Replies: 2
    Last Post: 10-14-2012, 10:00 AM
  7. Separate Data from Master Worksheet into Individual Worksheets
    By bhenderson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2011, 02:14 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