+ Reply to Thread
Results 1 to 7 of 7

Dividing the Items of an Array over multiple Columns

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Dividing the Items of an Array over multiple Columns

    Hi all,

    IMG1.jpg

    I'm trying to divide the items of an array over 3 columns
    Like in the image above.

    I've tried the following but without succes

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Dividing the Items of an Array over multiple Columns

    Hi again Jonathan78
    Using exactly the ideas ( and a lot of the code ! ) that I showed you here yesterday:
    http://www.excelforum.com/showthread...t=#post4381996

    This code is much simpler version of that. .....!....

    Please Login or Register  to view this content.
    It will take for example this

    Using Excel 2007
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    1
    Area 1
    Area 59
    6
    1
    1
    any
    3
    Finks
    pgcArraysSplitToColumn


    And it will give you this

    Row\Col
    A
    B
    C
    40
    1
    Area 1
    Area 59
    41
    6
    1
    1
    42
    any
    3
    Finks


    And here a simplified code version ( Note to run it you still need the Function shgMathsVBASHimpfGlified copied to the same module as the Main code )

    Please Login or Register  to view this content.

    Alan



    Jack ....done it nice ??
    Last edited by Doc.AElstein; 05-10-2016 at 12:49 PM.
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

  3. #3
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    6,274

    Re: Dividing the Items of an Array over multiple Columns

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  4. #4
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Dividing the Items of an Array over multiple Columns

    Exactly what I was looking for, Thanks Bernie!

  5. #5
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Re: Dividing the Items of an Array over multiple Columns

    Thanks Doc.AElstein, but I go for the shorter solution

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Dividing the Items of an Array over multiple Columns

    Since I finished this after the other posts, here it is for what it is worth.

    Keep in mind that simple or short solutions are not always optimized for speed. Settings like ScreenUpdating, Calculation, Events, and such can be used to help with speed issues. My Speedup routines: http://vbaexpress.com/kb/getarticle.php?kb_id=1035

    I find that writing to an array and then writing to a range all at once is faster than one cell at a time. For your scenario, speed should not be a significant issue.

    Please Login or Register  to view this content.

  7. #7
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Dividing the Items of an Array over multiple Columns

    Thanks Kenneth Hobson and Bernie Deitrick for adding here

    Alan

    _..

    And here just a couple of versions of my code that do not need the Column Letter Function ( Function to get the Column Letter from Column Number )

    The original Function is simply included in the main code line in the first code.

    Please Login or Register  to view this content.








    _................................


    For the second a simple Function to get the Column Letter from Column Number is incorporated into the main Code


    Please Login or Register  to view this content.


    As before for thes examples, this is the Input Range.
    Using Excel 2007
    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    1
    1
    Area 1
    Area 59
    6
    1
    1
    any
    3
    Finks


    Output is
    Using Excel 2007
    Row\Col
    A
    B
    C
    40
    1
    Area 1
    Area 59
    41
    6
    1
    1
    42
    any
    3
    Finks


    _..........................................................

    So Last column is ( lClm ) is 9
    Wanted Width ( Widf ) is 3
    Wanted Top left is A40
    Last edited by Doc.AElstein; 05-11-2016 at 02:58 AM. Reason: Addae a coule of alternatives

+ 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. Array formula to return list of unique items from selected columns only
    By jlawton1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-23-2016, 04:53 AM
  2. Summing items in multiple columns
    By lmccaigue in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-08-2015, 12:35 PM
  3. [SOLVED] [SOLVED] Array formula to sum items that meet multiple conditions
    By TPDave in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-07-2014, 08:16 AM
  4. [SOLVED] Count several items in multiple columns
    By zhead in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-25-2014, 10:14 PM
  5. [SOLVED] Using Index and Match to search an array that has multiple items in each cell
    By tdlewis in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-20-2012, 08:45 PM
  6. [SOLVED] Excel 2007 : Trying to match like items in multiple columns
    By Cshadwick07 in forum Excel General
    Replies: 4
    Last Post: 06-14-2012, 01:21 PM
  7. Select multiple listbox items and pass to an array
    By golzilla in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-13-2005, 05:49 PM

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