+ Reply to Thread
Results 1 to 9 of 9

Copying Formula down incrementing every 4 rows

  1. #1
    Registered User
    Join Date
    06-19-2014
    Location
    toronto
    MS-Off Ver
    2014
    Posts
    4

    Copying Formula down incrementing every 4 rows

    I'm going to simplify my actual situation so its easier to explain:

    I have two sheets. Sheet 1 has a bunch of words in column A:
    A
    apple
    banana
    carrot
    donut

    in Sheet 2, i need to create 4 rows of data for EACH row in Sheet 1. it should look like this in sheet 2:
    A
    "apple +5"
    "apple +10"
    "apple +15"
    "apple +20"
    "banana +5"
    "banana +10"
    "banana +15"
    "banana +20"
    "carrot +5"
    "carrot +10"
    "carrot +15"
    "carrot +20"

    but when i enter my formulas in Sheet 2 and copy down, instead of entering "donut +5" like it should, its grabbing cell A13 from Sheet 1 and skipping everything entered from A4-A12. how can i get it so the formula grabs A1 for the first 4 rows, A2 for the next 4, A3 for the next 4 and so on. Thanks.

  2. #2
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Copying Formula down incrementing every 4 rows

    Hi,

    =IF(ROWS($1:1)>4*COUNTA(Sheet1!$A$1:$A$4),"",INDEX(Sheet1!$A$1:$A$4,1+INT((ROWS($1:1)-1)/4))&" +"&5+MOD(5*(ROWS($1:1)-1),5*COUNTA(Sheet1!$A$1:$A$4)))

    Copy down until you start to get blanks.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  3. #3
    Registered User
    Join Date
    06-19-2014
    Location
    toronto
    MS-Off Ver
    2014
    Posts
    4

    Re: Copying Formula down incrementing every 4 rows

    Quote Originally Posted by XOR LX View Post
    Hi,

    =IF(ROWS($1:1)>4*COUNTA(Sheet1!$A$1:$A$4),"",INDEX(Sheet1!$A$1:$A$4,1+INT((ROWS($1:1)-1)/4))&" +"&5+MOD(5*(ROWS($1:1)-1),5*COUNTA(Sheet1!$A$1:$A$4)))

    Copy down until you start to get blanks.

    Regards
    Thanks, it appears thats what I need. Only problem is my formula is a little more complicated than just adding +5 +10 +15 to the end.

    Could you perhaps modify it so it will just output the value from Sheet 1 four times? So it looks something like this in Sheet 2:

    apple
    apple
    apple
    apple
    banana
    banana
    banana
    banana
    carrot
    carrot
    carrot
    carrot

    then i can work with adding my formula to those. thanks for the help

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Copying Formula down incrementing every 4 rows

    Just remove everything after and including &" +"...

    Regards

  5. #5
    Registered User
    Join Date
    06-19-2014
    Location
    toronto
    MS-Off Ver
    2014
    Posts
    4

    Re: Copying Formula down incrementing every 4 rows

    Quote Originally Posted by XOR LX View Post
    Just remove everything after and including &" +"...

    Regards
    When I do that and copy it down im just getting "apple" in every row. the formula i entered is:
    =IF(ROWS(1:1)>4*COUNTA(Sheet1!$A$1:$A$4),"",INDEX(Sheet1!$A$1:$A$4,1+INT((ROWS(1:1)-1)/4)))

    had to add an extra bracket on the end after i deleted everything after &" +"

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Copying Formula down incrementing every 4 rows

    Here's another one.

    Data Range
    A
    B
    1
    apple
    apple
    2
    banana
    apple
    3
    carrot
    apple
    4
    donut
    apple
    5
    banana
    6
    banana
    7
    banana
    8
    banana
    9
    carrot
    10
    carrot
    11
    carrot
    12
    carrot
    13
    donut
    14
    donut
    15
    donut
    16
    donut
    17


    This formula entered in B1:

    =IFERROR(INDEX(A$1:A$4,CEILING(ROWS(B$1:B1)/4,1)),"")

    Copy down until you get blanks.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  7. #7
    Registered User
    Join Date
    06-19-2014
    Location
    toronto
    MS-Off Ver
    2014
    Posts
    4

    Re: Copying Formula down incrementing every 4 rows

    Quote Originally Posted by Tony Valko View Post
    Here's another one.

    Data Range
    A
    B
    1
    apple
    apple
    2
    banana
    apple
    3
    carrot
    apple
    4
    donut
    apple
    5
    banana
    6
    banana
    7
    banana
    8
    banana
    9
    carrot
    10
    carrot
    11
    carrot
    12
    carrot
    13
    donut
    14
    donut
    15
    donut
    16
    donut
    17


    This formula entered in B1:

    =IFERROR(INDEX(A$1:A$4,CEILING(ROWS(B$1:B1)/4,1)),"")

    Copy down until you get blanks.
    thanks this works. thanks to XOR LX for the help as well. cheers

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Copying Formula down incrementing every 4 rows

    Quote Originally Posted by alonzoharris View Post
    When I do that and copy it down im just getting "apple" in every row. the formula i entered is:
    =IF(ROWS(1:1)>4*COUNTA(Sheet1!$A$1:$A$4),"",INDEX(Sheet1!$A$1:$A$4,1+INT((ROWS(1:1)-1)/4)))

    had to add an extra bracket on the end after i deleted everything after &" +"
    It looks like the dollar signs $ are missing in the ROWS functions:

    =IF(ROWS($1:1)>4*COUNTA(Sheet1!$A$1:$A$4),"",INDEX(Sheet1!$A$1:$A$4,1+INT((ROWS($1:1)-1)/4)))

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Copying Formula down incrementing every 4 rows

    Quote Originally Posted by alonzoharris View Post
    thanks this works. thanks to XOR LX for the help as well. cheers

    You're welcome. We appreciate the feedback!

    If your question has been solved please mark the thread as being solved.

    In the menu bar above the very first post select Thread Tools, then select Mark this thread as solved.

+ 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. Incrementing IF formula's by rows
    By Alexvs in forum Excel General
    Replies: 4
    Last Post: 12-09-2010, 12:10 PM
  2. Problems with auto incrementing formula copying?
    By troykristoffer in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-04-2008, 06:30 PM
  3. [SOLVED] How do I prevent a formula element from incrementing when copying
    By Copying Excel Formulas in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2005, 01:05 PM
  4. Replies: 1
    Last Post: 03-10-2005, 04:54 AM
  5. Incrementing formula by two rows
    By Ben Hur in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-24-2005, 06:06 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