+ Reply to Thread
Results 1 to 11 of 11

Easier way to copy and paste values into a single line?

  1. #1
    Registered User
    Join Date
    02-26-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel
    Posts
    6

    Easier way to copy and paste values into a single line?

    Hey first post, can anybody give me advice on this? Thanks in advance.

    I'm working on collecting data from a database so I copy and paste from the database to an excel sheet. There are values at specific timepoints that I am collecting. The issue with this specific database is that not all the values I need are presented in a neat, single row, so this requires me to copy+paste duplicate timepoints and then reorganizing them manually on the Excel sheet.

    For example: I would c+p values 1, 2, 3 at time-point A. Subsequently, I would then c+p values 4,5,6 at that same timepoint A (no other option that the database gives me). I would then manually shift the values 4,5,6 on to the same row for values 1,2,3 so I can neatly display timepoint A, values 1, 2,3,4,5,6 in a single neat row.

    Are there any functions that could automatically take values of the same timepoint and join them into a single row? This would save me tremendous amounts of time c+p'ing manually just to get values on to the same row and same timepoint...

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Easier way to copy and paste values into a single line?

    Hi Boston dweller and welcome to the forum,

    To give a better answer we should see a sample of what you mean. You can attach a sample using "Go Advanced" and then click on the Paper Clip Icon above the advanced message area. I think this might be an easy problem but what the data looks like is more of the problem to give you a good answer.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-26-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel
    Posts
    6

    Re: Easier way to copy and paste values into a single line?

    Alright so I attached this sample book.

    The first sheet is supposed to show you how I just copy and paste everything from the database at first.

    The second sheet is supposed to show you the duplicate timepoints and the values. Can you see what I mean? There are two lines with the same timepoint

    for example
    2/24/15 00:15 EST values 1 2 3 - - -
    2/24/15 00:15 EST values - - - 4 5 6

    How can I just get them to join into a single row without manually copying and pasting it into one line?

    2/24/15 00:15 EST values 1 2 3 4 5 6
    Attached Files Attached Files
    Last edited by baustonian8; 02-26-2015 at 12:29 PM.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Easier way to copy and paste values into a single line?

    Hi,

    See if this saves some time for you. On your Timepoints sorted sheet. I see that you know how to autofilter and sort by time.

    Do this.....
    Click in cell J4 and drag down to P75. This will select this whole block.
    Then put the cursor on the top of the selected block and drag it up ONE Row.
    Now all your data is on the same rows, instead of doing them one at a time. Then filter out all blank rows using any one of the column dropdowns.

    A problem might occur if you don't have two times exactly the same.
    In that case some VBA might be a better method.

    Reply back after you have tried this manual method. If there might be missing times between the two sets of data then we'll find a better method.

    If the above manual method

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Easier way to copy and paste values into a single line?

    Ok - I have a better answer than the manual one above.

    After seeing it was vital records and needed to decrease your BP doing this problem, here is the answer.

    In J3 put this formula and pull it across and down
    =VLOOKUP($A3,INDIRECT("$A"&ROW()+1&":$P" & COUNTA($A:$A)),COLUMN(),FALSE)

    See the attached

    So what does this fancy formula do?
    It looks at the Time in Column A and then looks down the sheet for a matching time. If and when it finds a match to the time it returns the number in the same column the formula is in to that cell.

    I think this is a better answer.

    I'd then copy and paste VALUES ONLY over my formulas to set the numbers in those cells.

    Watch out for that blank column between data sets. This will make the
    COUNTA($A:$A) short a few for each blank line between the sets. You could add a few rows to be safe by making the formula...

    =VLOOKUP($A3,INDIRECT("$A"&ROW()+1&":$P" & COUNTA($A:$A)+10),COLUMN(),FALSE)

    I hope this brings your BP down and helps analyze data and save patients.
    Last edited by MarvinP; 02-26-2015 at 01:12 PM.

  6. #6
    Registered User
    Join Date
    02-26-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel
    Posts
    6

    Re: Easier way to copy and paste values into a single line?

    Alright so when I pull it across it looks like it works, but pulling it say all the way down to P75 gives me N/A. Do I have to go to each line and then just input the formula at J3 J5 J7 and just pull it across?

    Yeah thanks, my BP is way too high from all this c+ping im doing haha.

    Another thing is, there are a lot of instances in which there is a rogue timepoint that doesn't have a duplicate, so the above manual method would not work (taking from J4 and highlighting to P75 then dragging it a row above)
    Last edited by baustonian8; 02-26-2015 at 01:15 PM.

  7. #7
    Registered User
    Join Date
    02-26-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel
    Posts
    6

    Re: Easier way to copy and paste values into a single line?

    Thanks a lot MarvinP. I'm gonna give it a try this afternoon and reply back with any issues, this seems to be a good solution. I appreciate the help!

  8. #8
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Easier way to copy and paste values into a single line?

    This is why we need to see the real data.

    First you only pull the formula down for the TOP set of your data. Then Copy and past VALUES ONLY over the top of the formulas. Then you can delete the rows for the bottom set of data.

    If the times don't match exactly then we might need to do a MRound function to get them all within the same 15 second (whatever makes sense) range. After this MRound then the timestamps between machines problem might go away.

    See if this helps... If not show me where the problems are and we can drop your BP more.

  9. #9
    Registered User
    Join Date
    02-26-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel
    Posts
    6

    Re: Easier way to copy and paste values into a single line?

    Marvin,
    sample book 2.xlsx
    Here are a few updates:

    I've actually discovered I can retrieve data from the database in an easier way that doesn't create duplicate time points. However, I have an issue with formatting.

    Is it possible to transpose and flip the rows and columns for better visual presentation? The example here is attached "sample book 2", and the sheet that I have is "template" and I want it to look somewhat like the sheet "how do I transpose". Note that "how do I transpose" doesn't have all the column values, it was just an example of like the first couple values in the first column.

    Thanks!

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Easier way to copy and paste values into a single line?

    Here is how to do what I think you want...

    On your template sheet you have a blank row at row 27. Delete this whole row to make your data a full table.

    Then select all your data from A1 to PK54 and Ctrl-C (Copy it)

    Go to sheet 3 and click on cell A1. Right click on A1 and Paste Special. Check the "Transpose" checkbox and then OK.

    This will get what you want - with a few changes needed on the top of the sheet.

  11. #11
    Registered User
    Join Date
    02-26-2015
    Location
    Boston, MA
    MS-Off Ver
    Excel
    Posts
    6

    Re: Easier way to copy and paste values into a single line?

    Oh my god.

    You are the absolute best! Thank you so much!

+ 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: 12
    Last Post: 03-05-2016, 03:03 PM
  2. Replies: 8
    Last Post: 07-14-2014, 03:07 AM
  3. Replies: 0
    Last Post: 06-24-2014, 05:51 PM
  4. Replies: 4
    Last Post: 11-04-2013, 11:29 AM
  5. Replies: 5
    Last Post: 05-25-2013, 07:12 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