+ Reply to Thread
Results 1 to 8 of 8

Merge/Consolidate data in specific columns

  1. #1
    Registered User
    Join Date
    03-22-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    6

    Merge/Consolidate data in specific columns

    I have a list of patients with numbered tumor sites and I'm looking for a way to consolidate my data with entries for a third column (genotype) which remains not assigned (NA) until I receive the final results from all the hospitals within my region. The function might look like a double vertical lookup, but I'm looking for the best practice when it comes to merging that kind of data.

    I'm posting the data here, because the attachment option does not show my uploaded file within the post.
    ===Sheet1===
    Patient Tumor Genotype
    PT01 1 NA
    PT01 2 NA
    PT02 1 NA
    PT02 2 NA
    PT02 3 NA
    PT03 1 NA
    PT04 1 NA
    PT05 1 NA
    PT06 1 NA
    PT07 1 NA
    PT07 2 NA
    PT08 1 NA
    PT09 1 NA
    PT10 1 NA
    PT10 2 NA
    PT10 3 NA
    PT10 4 NA
    PT10 5 NA
    PT10 6 NA

    ===Sheet2===
    Patient Tumor Genotype
    PT01 1 GG
    PT01 2 TT
    PT02 3 GG
    PT03 1 TT
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Merge/Consolidate data in specific columns

    So what is your expected outcome?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Merge/Consolidate data in specific columns

    I put this in D2 and copied down...
    =IFERROR(INDEX(G:G,MATCH(A2&B2,INDEX($E$1:$E$5&$F$1:$F$5,0),0)),"")
    was this what you wanted?

  4. #4
    Registered User
    Join Date
    03-22-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    6

    Re: Merge/Consolidate data in specific columns

    Quote Originally Posted by FDibbins View Post
    I put this in D2 and copied down...
    =IFERROR(INDEX(G:G,MATCH(A2&B2,INDEX($E$1:$E$5&$F$1:$F$5,0),0)),"")
    was this what you wanted?
    I'm looking for a function or (macro)command that replaces NA in Sheet1, column C with the correct values from Sheet2 by correctly picking (a) the patient number and (b) the right tumor number.
    Quote Originally Posted by FDibbins View Post
    So what is your expected outcome?
    I haven't been successful with anything that I've tried, yet.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Merge/Consolidate data in specific columns

    No, I meant, we need to know what your answer would look like, even if you do it manually. If you wantthe existing ce contents to be replaced, you will need VBA, a formula wont do that. If you want the formula IN that cell instead of the NA, we could probably do that...or you could use a helper column next t teh NA column.

    But I need to know what your answer would look like

  6. #6
    Registered User
    Join Date
    03-22-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    6

    Re: Merge/Consolidate data in specific columns

    The final answer will look like this.

    PT01 1 GG
    PT01 2 TT
    PT02 1 NA
    PT02 2 NA
    PT02 3 GG
    PT03 1 TT
    PT04 1 NA
    PT05 1 NA
    PT06 1 NA
    PT07 1 NA
    PT07 2 NA
    PT08 1 NA
    PT09 1 NA
    PT10 1 NA
    PT10 2 NA
    PT10 3 NA
    PT10 4 NA
    PT10 5 NA
    PT10 6 NA

    I'm essentially looking for a method for replacing specific cells by reading columns 1 and 2. Changes will happen over a period of time as some hospitals take time to provide me with the results, so I would prefer that "NA" cells with no entries on Sheet2, to be left unchanged. If Visual Basic code is the only solution I'd like to see your suggestion, assuming that the code could be easily adjusted for more columns in the future.

    Note that the data I provide is totally fictional. The real database contains 22000 entries but I am not allowed to share it.

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Merge/Consolidate data in specific columns

    Did you try my suggestion in post # 3?

  8. #8
    Registered User
    Join Date
    03-22-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    6

    Re: Merge/Consolidate data in specific columns

    I've tried it but it didn't work.

+ 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. Consolidate and Merge Data on a Separate Sheet
    By astole in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-23-2014, 04:32 PM
  2. Replies: 1
    Last Post: 10-24-2013, 01:05 PM
  3. Get, Merge & Consolidate Data - Help Request!!!
    By techzia in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-13-2012, 05:35 PM
  4. MERGE and Consolidate excel data from 750 wookbooks into one wookbook.
    By AZZ70 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2012, 11:55 PM
  5. Add data columns and merge specific data sheets into master sheet
    By sshahils in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-15-2011, 10:50 AM
  6. Merge / Consolidate data
    By jhayes in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-31-2007, 08:15 PM
  7. [SOLVED] Consolidate and Merge Data on a Separate Sheet
    By in forum Tips and Tutorials
    Replies: 0
    Last Post: 01-01-1970, 12:00 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