+ Reply to Thread
Results 1 to 11 of 11

How do I automatically fill the next available column to my left for longitudinal data?

  1. #1
    Registered User
    Join Date
    12-31-2014
    Location
    New York City
    MS-Off Ver
    Excel 2010
    Posts
    5

    Question How do I automatically fill the next available column to my left for longitudinal data?

    Hey guys!

    Microsoft Excel 2010 here

    So I'm working on longitudinal Data. I've merged data from different data sets and am trying to build one big longitudinal data set.

    The data set has columns for different debt, savings amounts for our non-profit clients, and because this is case management data its a nightmare putting together with rows that have spaces in between the trials inconsistently. Below is what I have and what I would like to be able to do:

    what it looks like now.pngwhat I would like to see.png

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Select the cells with the data and Hit "F5" and click Special Cells=>Blanks=>ok then Right click on one of the blank cells and select Delete, another window will pop up and select "To Left"

    Or use this bit of code
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-31-2014
    Location
    New York City
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Hmm, it didn't work, when I went via the F5 route I got "no cells found," I must be doing something wrong. Here is a picture of the data hopefully illustrating the dilemma in a better way:

    The blue in the second picture represents what I'd liked filled. The Red represents a block of the data I would like to be moved to the left to fill the blue. Obviously the blank cells within the red won't fill anything lol.

    excel what it looks like.png
    excel highlights where i want it to be.png

    Thanks again!

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Please don't expect us to recreate your worksheet when you can easily attach it to your post.

  5. #5
    Registered User
    Join Date
    12-31-2014
    Location
    New York City
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Sorry about that, my mistake, simply thought an image might be enough. I've attached a
    snippet of the data.

    Really appreciate any help. Thanks!
    Attached Files Attached Files

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Rather than going laterally, why not enter vertically which is much easier to calculate with?
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: How do I automatically fill the next available column to my left for longitudinal data

    You have a lot of cells with the value of " " (Space) inside of them instead of ""(Blank)

    I used a filter code to delete these spaces and turn the cell into blanks.
    Then use special cells to delete the blanks.
    Try the attched macro enabled workbook.
    Click Do it button to run the code.
    Click reset button and sheet 2 will copy back to sheet1
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    12-31-2014
    Location
    New York City
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Thanks for the help! The Macro worked perfectly. Bare with my ignorance but how were you able to tell that the spaces were not actually "" (blank)?

    Also, newdoverman, I was thinking about that as a possibility, how would you go about moving the lateral data vertically in an automated fashion?

    Thanks guys!

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Someone expert in VBA might be able to write code to convert your horizontal data into a proper vertical arrangement.

    If you are just starting out, go vertical to start with. In my own opinion horizontal data is a disaster and worth almost any effort to get rid of.

  10. #10
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Quote Originally Posted by faustolopez110 View Post
    ..........how were you able to tell that the spaces were not actually "" (blank)?

    .....
    I knew something was up when the code from post 2 did not work for you.
    When I opened your workbook
    I typed in the formula =len(k9) and the answer was 1, when it should have been 0 if it was truly blank.

  11. #11
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: How do I automatically fill the next available column to my left for longitudinal data

    Your data endpoint is actually GB26 and there are many cells that only contain spaces. A search and replace for spaces produced a count of 3369.

+ 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] How to name cells automatically using top row and left column entries
    By ericrichard25 in forum Excel - New Users/Basics
    Replies: 13
    Last Post: 09-21-2014, 11:55 PM
  2. Replies: 2
    Last Post: 06-03-2014, 10:52 AM
  3. Formula to Automatically Fill Blank With Next fill cell's data?
    By VMoney in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-22-2013, 05:11 PM
  4. Replies: 2
    Last Post: 04-16-2012, 09:42 AM
  5. Replies: 28
    Last Post: 02-03-2012, 05:12 AM

Tags for this Thread

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