+ Reply to Thread
Results 1 to 14 of 14

add one dimension to array

  1. #1
    Registered User
    Join Date
    10-04-2014
    Location
    israel
    MS-Off Ver
    2010
    Posts
    24

    add one dimension to array

    hi

    i want to add one dimension to an array
    here is part of the code

    Please Login or Register  to view this content.
    any way...i receive an error
    any help?

    thanks
    Last edited by shaykos; 12-03-2015 at 02:48 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: add one dimension to array

    Please take a few minutes to re-read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-04-2014
    Location
    israel
    MS-Off Ver
    2010
    Posts
    24

    Re: add one dimension to array

    yes sir haha

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: add one dimension to array

    You haven't dimensioned Array2.
    If posting code please use code tags, see here.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: add one dimension to array

    Please Login or Register  to view this content.
    Converts 1D array to 1 Based 2D array.

  6. #6
    Registered User
    Join Date
    10-04-2014
    Location
    israel
    MS-Off Ver
    2010
    Posts
    24

    Re: add one dimension to array

    hi
    sorry for that but i still dont understand this method(only when paste vertical to horizontal and vice versa)
    can u show me the full code to convert one dimension array to 2D?
    column A is identifier(one number) and the the B column(same row) is data breaks by commas(1,4,3,2,4,0,0,0,3,2...)
    i just want for each of those rows to make column A as the first dimension(the number of elements is the rows number) and the second dimension is the data in column B

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: add one dimension to array

    Ahhh, you want it as
    Please Login or Register  to view this content.
    But why do you need it so?

    Transpose will give you
    Please Login or Register  to view this content.
    So this is not what you want.

  8. #8
    Registered User
    Join Date
    10-04-2014
    Location
    israel
    MS-Off Ver
    2010
    Posts
    24

    Re: add one dimension to array

    still got en error with this
    I'll give an example for what i need(suppose to be simple to do that)
    column A____ column B
    1 __________ 1,2,3,4,5....
    2 __________ 11,22,33,44,55...
    3 __________ 4,6,7,6,5,4,3,....
    4 __________ 1,3,5,7,8,0,3,4,2,....

    now i just want to call for example to Array2(3,5)
    and it should give me the 0
    Last edited by shaykos; 12-04-2015 at 07:40 PM.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: add one dimension to array

    I don't understand why you need it an array...

    I would do like
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-04-2014
    Location
    israel
    MS-Off Ver
    2010
    Posts
    24

    Re: add one dimension to array

    i heard that arrays works much faster than others methods
    actually it's a game results
    each row is a player
    the "1,3,2,4,0,3,2,..." (column B) is the answers of the player for each question
    finally i want to know the percentages for each answer for each question
    after i got an array(x,y) ; x-index of player ; y-all the answers
    i'll be able to continue with the calculations(and there are a lot of games)

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: add one dimension to array

    It depends how you use it.
    In your case, it is not much difference.

  12. #12
    Registered User
    Join Date
    10-04-2014
    Location
    israel
    MS-Off Ver
    2010
    Posts
    24

    Re: add one dimension to array

    the issue is that i need that array for calculation
    simple example: only one game, only 4 players,only 4 questions,only 4 answers for each question:
    after i get the array i want to do:
    Please Login or Register  to view this content.

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: add one dimension to array

    If you upload a workbook with data and the result taht you want, it may help understanding what you are trying to do.
    However, reading your code is not understandable.

    If you know about array, you should have loaded the data with loop or even manually, because it is 0 based.
    So how would I know what you want to do?

  14. #14
    Registered User
    Join Date
    10-04-2014
    Location
    israel
    MS-Off Ver
    2010
    Posts
    24

    Re: add one dimension to array

    ok...i think i got it
    the issue was because i have to declare number of elements to the array...something with "Redim"

    Please Login or Register  to view this content.
    its not clean but it work now (based on my worksheet data)

    Thanks u for the effort

+ 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. Excel: Sum each dimension of an Array
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 42
    Last Post: 06-08-2015, 11:35 PM
  2. [SOLVED] Sort a 2 dimension array
    By tradinup2 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 02-28-2013, 10:29 AM
  3. Does filling part of an array from a range re-dimension the array?
    By barryleajo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-04-2011, 10:09 AM
  4. Cycling through 1 dimension of an array
    By Phil_V in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2009, 09:51 AM
  5. Array dimension declaration
    By yellephant in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2007, 08:44 AM
  6. Array dimension
    By Henrietta Klaus in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2006, 11:10 AM
  7. Mutli-dimensional Array to Single-Dimension Array
    By Blue Aardvark in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2005, 05:05 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