+ Reply to Thread
Results 1 to 5 of 5

incrementing row/column data in formula

  1. #1
    Registered User
    Join Date
    08-20-2004
    Location
    UK
    MS-Off Ver
    2007
    Posts
    5

    incrementing row/column data in formula

    I'm trying to increment the row/column data in a formula and can't figure out how to do it. (It may simply be a case of transposing the data, but not sure if that will work)

    Eg. I have a column of data

    A
    red
    green
    blue
    yellow
    purple
    orange

    I want to place this data in another 2 columns such that

    B C
    red green
    blue yellow
    purple orange

    and so on..

    I actually have a few hundred rows, so want to know if there is a way to either copy down or by somehow using a formula make it so that the column B takes the 1st, 3rd, 5th values in column A etc.. and column C takes the 2nd, 4th and 6th values in column A etc..

    I'm looking for something like this, (though these formulas don't actually work of course - I wish it was that simple though)
    ie.
    B1 = A1,
    B2 = A(1+2),
    B2 = A(1+4),

    Am I simply making this out to be more difficult than I think it is?
    Last edited by master811; 05-06-2009 at 04:19 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: incrementing row/column data in formula

    You can use INDEX to do this... using your example

    B1: =INDEX($A:$A,COLUMNS($B1:B1)+(2*(ROWS(B$1:B1)-1)))

    can be applied to matrix B1:C6

  3. #3
    Registered User
    Join Date
    08-20-2004
    Location
    UK
    MS-Off Ver
    2007
    Posts
    5

    Re: incrementing row/column data in formula

    Quote Originally Posted by DonkeyOte View Post
    You can use INDEX to do this... using your example

    B1: =INDEX($A:$A,COLUMNS($B1:B1)+(2*(ROWS(B$1:B1)-1)))

    can be applied to matrix B1:C6
    Thanks, that works perfectly.

    Just one question, how can I move the starting point (so say I want to go from A2 downwards)?

    Simply editing the first index doesn't seem to work.

  4. #4
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: incrementing row/column data in formula

    instead of $A:$A put $A2:$A100 (or as many as you want)

  5. #5
    Registered User
    Join Date
    08-20-2004
    Location
    UK
    MS-Off Ver
    2007
    Posts
    5

    Re: incrementing row/column data in formula

    Quote Originally Posted by zbor View Post
    instead of $A:$A put $A2:$A100 (or as many as you want)
    Although that works for the first value it breaks the existing formula and means the values become out of order and in their wrong respective columns when you copy and paste downwards.

    Edit: ignore that, if I add a '$' in before the row number, it works again.
    Last edited by master811; 05-06-2009 at 04:50 AM.

+ 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