+ Reply to Thread
Results 1 to 7 of 7

How to repeat a formula automatically every seven columns

Hybrid View

  1. #1
    Registered User
    Join Date
    02-16-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    10

    How to repeat a formula automatically every seven columns

    Hello, this is a cross-post and the link to the original message is here:

    http://www.excelforum.com/excel-new-...-few-rows.html

    I posted in the new users forum but I think it's a more appropriate question here, and also it seems like there are not many viewers in the new users forum. Admins can delete the original post; I would do it myself but I don't think there's a way to do that. I won't cross-post anymore. Here is my question:

    I have a formula that is working, but I want to repeat it every seven columns. I know I can drag it and release it (or drag a few and release them in the appropriate column), but at this point I have so many columns that it's quite cumbersome to do that. Is it possible to create a macro that will automatically repeat the formula in every cell seven columns to the right (the same row for all)?

    My formula is in cell K7 is:

    =IF(AND(K24<=0%,K24>=-2%,OR(J32="T",J32="F")),1,"FALSE")

    Now I want that formula to repeat (with the proper adjustments) for cell R7, i.e.:
    =IF(AND(R24<=0%,R24>=-2%,OR(Q32="T",Q32="F")),1,"FALSE")

    and then to automatically continue like that for cells Y7, AF7, AM7, and so on.

    Is there a way to do this? Thank you!
    Last edited by Capa; 02-19-2010 at 05:14 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How to repeat a formula automatically every seven columns

    Copied how many times?

    Copy K7 only? Or is this a range of cells....e.g. K7:K100 ?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: How to repeat a formula automatically every seven columns

    see attached sample.

    it uses the following macro

    Sub repeat_Formula()
    
    times = Range("K2").Value
    col = Range("K3").Value
    
    For i = 1 To times
    Range("K7").Copy _
        Destination:=Range("K7").Offset(0, i * col)
    Next i
        
    
    End Sub



    you can define how many times and every so many columns to repeat.
    modytrane
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: How to repeat a formula automatically every seven columns

    here's a copy with RUN button to execute the macro.
    modytrane
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    02-16-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to repeat a formula automatically every seven columns

    The range will actually be the 7th row starting with K7, not the K column. So for now let's make the range K7:AFE7. I want it to copy every seven columns over, Y7, AF7, AM7, etc.

  6. #6
    Registered User
    Join Date
    02-16-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to repeat a formula automatically every seven columns

    Thank you for your help. Unfortunately it's not working when I run it, and I'm so new to Excel that I don't know what I'm doing wrong.
    Last edited by Capa; 02-19-2010 at 05:10 PM.

  7. #7
    Registered User
    Join Date
    02-16-2010
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: How to repeat a formula automatically every seven columns

    Nevermind, I realized what I did wrong. Works perfectly! Thank you for your help.

+ 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