+ Reply to Thread
Results 1 to 8 of 8

Using information from two tables to create a new table

  1. #1
    Registered User
    Join Date
    03-26-2017
    Location
    London
    MS-Off Ver
    13
    Posts
    23

    Using information from two tables to create a new table

    Hi,

    I have a table of information which gives participant ID, drug start date, drug stop date

    Please Login or Register  to view this content.
    I have another table which gives participant ID and scores.

    Please Login or Register  to view this content.

    I would like a table which includes
    Before score (or scores)= any score which comes before the start date
    During score (or scores) = any score which comes after the start date BUT before the stop date (so scores which are collected when someone is taking the drug).

    (Note that each participant may have more than one before or during score).


    Please Login or Register  to view this content.


    Any help with this would be very much appreciated!

    Thanks!
    Last edited by JBeaucaire; 03-26-2017 at 05:33 PM.

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,590

    Re: Using information from two tables to create a new table

    Hello London123 and Welcome to Excel Forum.
    This proposed solution employs a helper range which is highlighted in yellow on sheet 2, and which may be hidden for aesthetic purposes.
    The formula that populates the helper range is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    The formula that populates the table on sheet 3 is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Registered User
    Join Date
    03-26-2017
    Location
    London
    MS-Off Ver
    13
    Posts
    23

    Re: Using information from two tables to create a new table

    Thank you so much for your help JeteMc! In your excel you have achieved just what I wanted! However when I try to replicate it, it doesn't work. (I have made sure that the columns are in the same place and that I have labelled the tables the same as you did). Is there anything else I would need to check?

    Thanks!

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,590

    Re: Using information from two tables to create a new table

    If possible upload a desensitized version of the file that 'doesn't work' and we'll attempt to figure out the problem.
    To upload a file click on the GO ADVANCED button below the Quick Reply window and then scroll down to Manage Attachments to open the upload window. Note: The paperclip icon doesn't work.
    Let us know if you have any questions.

  5. #5
    Registered User
    Join Date
    03-26-2017
    Location
    London
    MS-Off Ver
    13
    Posts
    23

    Re: Using information from two tables to create a new table

    Hi,

    Its attached. When I copy and paste the first formula (for the helper range) if says there is an error with the formula. I am sorry if it is something very obvious!

    Thanks for your help!
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,590

    Re: Using information from two tables to create a new table

    The issue with the formula not working at all is that on Sheet1 in cells B1 and C1 there are spaces after the terms 'Start date' and 'Stop date'. There is a further issue on sheet 2 in some of the rows, such as 5, that was due to spaces in cells C5 and D5. I believe that adding the trim function to the first argument of the formula has corrected for that.
    Let us know if you have any questions.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    03-26-2017
    Location
    London
    MS-Off Ver
    13
    Posts
    23

    Re: Using information from two tables to create a new table

    Hi Jettemc,

    Sorry for the slow response I was travelling.

    Firstly, thank you so much for your help, the formula worked with the workbook I sent you and I was able to analyse the data!

    I have one more question please... when I copy the formula to another excel (which has the exact same layout as the previous one but different data) itdoesn't work. Please may you have a look why?

    I removed the spaces after the terms 'Start date' and 'Stop date' (as per your advice in the last message).

    Thanks!
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,590

    Re: Using information from two tables to create a new table

    The table names were switched. It should work fine now.
    Let us know if you have any questions.
    Attached Files Attached Files

+ 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: 4
    Last Post: 12-31-2016, 04:06 AM
  2. Multi Step VBA to Pull Information From Multiple Tables and Create a .CSV File
    By rslay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2016, 07:01 PM
  3. Replies: 1
    Last Post: 10-29-2015, 03:31 AM
  4. Replies: 9
    Last Post: 07-07-2015, 08:51 AM
  5. Create a tables with new name for each new table
    By JoeSkittles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2013, 03:17 PM
  6. I need to copy the information of several tables to a master table
    By JCM_28 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-19-2013, 12:59 PM
  7. Replies: 1
    Last Post: 03-23-2013, 08:46 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