+ Reply to Thread
Results 1 to 7 of 7

consolidation of scattered values

  1. #1
    Registered User
    Join Date
    11-24-2008
    Location
    North Carolina
    Posts
    41

    consolidation of scattered values

    I have a large range of data containing values in some but not all of the cells. Is there a fast way to consolidate all of the values into a list?

    Sheet1 of the attached file contains an example of the data I have. Sheet2 shows how I want to consolidate the data.

    Any help will be greatly appreciated!

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: consolidation of scattered values

    Hi Ezdizzy, perhaps the following macro will work for you. Adjust your column range as necessary.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-24-2008
    Location
    North Carolina
    Posts
    41

    Re: consolidation of scattered values

    Paul--

    Thanks so much for the quick reply. Unfortunately, I havae no experience with programming within excel. Do you know if there is a way to accomplish this using the funtions/formulas within excel already?

    Thanks again for your help.

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: consolidation of scattered values

    There probably are ways using multiple formulas and helper cells, but you don't need experience to run a macro. To add the code to your workbook (a copy, just in case), right-click on the sheet tab with your data and choose View Code. Paste the code I provided into the VB Editor window that appears. Adjust the Range("A:E") to include all of your columns, and change "For col = 2 to 5" to your used column range. (Column B = 2, C = 3, D = 4, E = 5, etc.) Close the VB Editor. Press ALT+F8 to open the Macros dialog window. Select reorgData and click OK/Run.

    The code assumes all of the data will be moved into column A, each set below the previous column's set of data.

  5. #5
    Registered User
    Join Date
    11-24-2008
    Location
    North Carolina
    Posts
    41

    Re: consolidation of scattered values

    Ok, I tried what you said, it worked fine with my small example but it is not working with my large actual scenario. A couple more questions:
    why is your range ("A:E"), but then the next line of codes shows: For col = 2 To 5 ' columns B to E?
    Also, I tried a couple of times, and now I am starting to see an error message with a red "X" and a "400" ?? any ideas?

  6. #6
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: consolidation of scattered values

    Try uploading a copy of your workbook here. I can then review it to see what might be happening. You can replace confidential data with fake data as long as the type of data is the same as you would expect to be there normally. (e.g. numbers where numbers would be, dates where dates, text where text would be..)

    As for using A:E on one line and then 2 to 5 on the next...

    The first line, Range("A:E"), is deleting all blank cells in columns A:E and shifting non-blank cells up so each column contains a list of values with no blanks starting in row 1.. You can make this A:K, C:BR, etc.

    The next line, col = 2 to 5, is there to loop through columns B:E. You don't need to loop from 1 to 5, because column A will already be done when the blanks are deleted. You can't loop through columns by letter, e.g. "col = B to E". (Well, you probably could, but would need additional code to handle that.)

    So if you adjust the range from A:E to A:J, you would also change "col = 2 To 5" to "col = 2 To 10" since column J is the 10th column.

  7. #7
    Registered User
    Join Date
    11-24-2008
    Location
    North Carolina
    Posts
    41

    Re: consolidation of scattered values

    Paul--

    So I went back and saved my workbook as a Macro-enabled workbook (duh!) and the macro worked perfectly. Thanks so much for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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