+ Reply to Thread
Results 1 to 12 of 12

how to take 3 cells vertically and make them 1 (or however many) horizontally?

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    4

    how to take 3 cells vertically and make them 1 (or however many) horizontally?

    I am using an ms dos based mckesson hosp software

    it sends out reports as text and when I import in excel, I have 3 entries going vertically a skipped row, and then 3 more entries going vertically.

    EG. Cell A1, A2 & A3 all contain one entry. It skips a line (A4), and then starts again with A5, A6 & A7 being the next entry, and on and on.

    How can i get it so say A1, A2 & A3 appear all in A1? (or A1, B1, and C1)

    In any case i want them all on one line.

    PS - this spreadsheet has over 120k lines all together

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    nyioves,

    Welcome to the Excel Forum.

    What is in cells:
    A1
    A2
    A3

    A5
    A6
    A7

    And, what should the new A1 look like?

    And, what should the new A2 look like?


    Even better:

    To get the most precise answer, it is best to upload/attach a sample workbook (sensitive data changed) that contains an example of your raw data on one worksheet, and on another worksheet your desired results.

    The structure and data types of the sample workbook must exactly duplicate the real workbook. Include a clear and explicit explanation of your requirements.

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    With the function indirect.

    See the attached file.

    Probably the function will get very slow on 120 K, while I used indirect.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Registered User
    Join Date
    05-17-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    in Cell B1 =A1&A2&A3


    Next highlight cell B1 to B4 and copy and paste to column b

    Select column B Copy and Paste Special to Transpose

    To delete blank columns in the transposed result...

    If there isn't a blank row above your data, insert one
    Then...
    •Beginning in the blank cell above the first data column (B1) type 1
    then in (F1) 2 and (J1) 3

    Next Drag this series to auto fill the numbers with one blank column in middle


    •Select all of the data, including all of the numeric series
    •From the ribbon:
    •••Home.Sort_&_Filter,Custom_Sort
    ••••••Click: options.Sort_left_to_Right....Click: OK
    ••••••Sort by: Row_1
    ••••••Sort by: Values
    ••••••Sort by: Smallest to largest
    ••••••Click: OK




    Colored Text Courtesy of the peers in the link below
    http://www.excelforum.com/excel-gene...g-columns.html

  5. #5
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    nyioves,

    If you have:
    A1 = 1
    A2 = 2
    A3 = 3

    A5 = 5
    A6 = 6
    A7 = 7

    A9 = 9
    A10 = 10
    A11 = 11


    After the below very fast macro using two arrays in memory you will have:

    A1 = 1 2 3
    A2 = 5 6 7
    A3 = 9 10 11


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgData macro.
    Last edited by stanleydgromjr; 06-06-2013 at 04:43 PM.

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    nyioves,

    If you have:
    A1 = 1
    A2 = 2
    A3 = 3

    A5 = 5
    A6 = 6
    A7 = 7

    A9 = 9
    A10 = 10
    A11 = 11


    After the below very fast macro using two arrays in memory you will have:

    A1 = 1, B1 = 2, C1 = 3
    A2 = 5, B2 = 6, C2 = 7
    A3 = 9, B3 = 10, C3 = 11

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgDataV2 macro.
    Last edited by stanleydgromjr; 06-06-2013 at 04:45 PM.

  7. #7
    Registered User
    Join Date
    06-06-2013
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    thanks a lot but you can just concat a1&a2&a3 in b1 then sort and delete all the unwanted stuff since the first cell always contains the word "item"

  8. #8
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    nyioves,

    You are very welcome. Glad we could help.

    you can just concat a1&a2&a3 in b1 then sort and delete all the unwanted stuff since the first cell always contains the word "item"
    PS - this spreadsheet has over 120k lines all together
    Not manually with 120k lines of raw data - very slooooooooooooooow.

    In the future I would suggest that you post a workbook with before and after worksheets. This way, you will get a correct solution the first time.

  9. #9
    Registered User
    Join Date
    06-06-2013
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    Want to open this back up since I want to learn new things and not keep doing things the way I always did them.

    Also it wasn't obvious before but now I realize some of the entries actually have 4 lines per entry but thankfully all have a space between each entry -- except when the stick the heads in the the middle of the spreadsheet. So now the question becomes -- going with the prior exampe -- how do i get a1, a2, a3, a4 in cell b1? and is it possible to get rid of the recurring headers in the spreadsheet?

    The macro needs debuggin -- presuming it was set up for a1, a2, a3 in b1 and I cannot figure out how to tweek the array also posted. and help is appreciated. Thanks!
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    nyioves,

    The macro needs debuggin
    I would think that the above presented macros all work with your original described raw data.


    You need to post another workbook with the raw data in worksheet Sheet1, and, in worksheet Sheet2 the results you are looking for (manually formatted by you) for the three and four row groups.

    Is there any chance that the groups will be larger than 3 or 4 rows?
    Last edited by stanleydgromjr; 06-10-2013 at 02:31 PM.

  11. #11
    Registered User
    Join Date
    06-06-2013
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    yes there are some that are las\rger than 3 or 4. but is there anything that could be done about that? Also there is the headers that show up and break up the groups.

    otherwise i just want each of the 3-4 line groups in one cell so i can text to columns them into fields. so check out sheet 2 it contains everything in one cell
    Attached Files Attached Files
    Last edited by nyioves; 06-10-2013 at 04:59 PM.

  12. #12
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: how to take 3 cells vertically and make them 1 (or however many) horizontally?

    nyioves,

    This is the last try.

    Please post another workbook with the following.

    In Sheet1:

    beginning in:


    B1 put the results from A1:A3

    B147 put the results from A147:A151

    B157 put the results from A157:A160

    B220 put the results from A220:A224

    B240 put he results from A240:A244

+ 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