+ Reply to Thread
Results 1 to 6 of 6

Alternate cell data based on different Spreadsheet data

  1. #1
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142

    Smile Alternate cell data based on different Spreadsheet data

    Hello all, Im new to the forum :-)

    Sorry for the slightly non-descriptive title, but i am struggling to describe what i want excel to do: so here goes;

    I have a file with 3 spreadsheets in; Spreadsheets 1, 2 and 3.

    In Spreadsheet 1 I have data listed in column A from row 1 to 5 for example.
    A1 - 10
    A2 - 200
    A3 - 13
    A4 - 5
    A5 - 600

    In spreadsheet 2 I have data listed again in rows 1 to 5 of column A, as below:
    A1 - Apples
    A2 - Pears
    A3 - Oranges
    A4 - Lemon
    A5 - Lime

    What i am trying to do in Spreadsheet 3 is to alternatly link the data from spreadsheet 1 and 2 to column A of spreadsheet 3. See example below of spreadsheet 3:

    A1 - 10 [Spreadsheet1!A1]
    A2 - Apples [Spreadsheet2!A1]
    A3 - 200 [Spreadsheet1!A2]
    A4 - Pears [Spreadsheet2!A2]
    A5 - 13 [Spreadsheet1!A3]
    A6 - Oranges [Spreadsheet2!A3]
    A7 - 5 [Spreadsheet1!A4]
    A8 - Lemon [Spreadsheet2!A4]
    A9 - 600 [Spreadsheet1!A5]
    A10 - Lime [Spreadsheet2!A5]


    Sorry for the rather poor example. I dont know if there is formula or VBA that i can use to do the above task. I need this to work with hundreds of rows in both spreadsheets 1 and 2 idealy.

    Thanks in Advance.

    PS Using Excel 2003

  2. #2
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142
    Thought it may help if i attached the above example file. Bearing in mind that i have manually linked each of the cells in column A of spreadsheet 3.

    Cheers
    Attached Files Attached Files

  3. #3
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Alternate cell data based on different Spreadsheet data

    Using your sample workbook...
    Try this on Sheet3...

    Please Login or Register  to view this content.
    Select A1:A2
    Left-Click and HOLD on the A2 fill handle (black box in the lower right of the cell)
    and drag down as far as you need.

    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  4. #4
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142
    Magic - That works great thank you!!

    A couple of questions:

    1.Could you explain the formula, for instance the 'CEILING(ROW()/2,1)'

    2.When i drag the cells down i get a bloack surround around the cells from Sheet2, the ones containg text? Is this normal?

    Thank you ever so much for your help. I really appreciate your speedy and consice response!

    Cheers

  5. #5
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Explanation of: =INDEX(Sheet1!$A:$A,CEILING(ROW()/2,1))

    Regarding:
    Please Login or Register  to view this content.
    The INDEX(rng, x, y) function references a range and returns the contents
    of the cell located in the x,y position in that range,
    where:
    x = vertical position in that range
    y = horizontal position in that range

    Since Sheet1!$A:$A only references a single column,
    we only need to identify the vertical postion: INDEX(rng, x)

    The CEILING(expression, value) function rounds the expression UP to the
    next multiple of value. In this example, the ROW() function returns the
    row_number of the cell containing the formula.

    The CEILING(ROW()/2,1) function divides the row_number by 2 and rounds
    that value UP to the next increment of 1.

    Examples:
    CEILING(1/2,1) returns: 1
    CEILING(2/2,1) returns: 1
    CEILING(3/2,1) returns: 2
    CEILING(4/2,1) returns: 2
    etc

    Consequently, every other row increments the referenced range by 1.

    I hope that helps.

  6. #6
    Forum Contributor
    Join Date
    07-28-2008
    Location
    Leamington Spa, UK
    MS-Off Ver
    2010
    Posts
    142
    Thats great thank you very much!

    Cheers

+ 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