+ Reply to Thread
Results 1 to 9 of 9

Automatically copy formula into adjacent cell when a new column is inserted

  1. #1
    Registered User
    Join Date
    05-14-2020
    Location
    England
    MS-Off Ver
    2010
    Posts
    13

    Automatically copy formula into adjacent cell when a new column is inserted

    Hi everyone,

    I am trying to get excel to automatically copy and insert formulas from one row into its adjacent new cells when a new column is inserted. I have turned ranges into tables and this only seems to work for rows but not columns, I explain my specific problem in more details below.

    In the excel worksheet (attached with random names and data), I have created a table across a range of cells and inserted row() functions into the cells in Column C (for serial numbers). This is so that each time I insert a new row, the serial number automatically updates. For example: If I insert a new row to appear after serial number 12 (row 16), the table automatically updates the new row serial number to 13 (row 17).

    excelA.JPG

    However, each time I insert a new column to include a new judge, the total row just above the bottom of the new column doesn’t update with the formula from its adjacent cell on the left.
    Example: I want to add information for a new Judge, say Judge 10, so I insert a new column to appear after N (a new “O” column). The conditional formatting copies to the new column’s cells adjacent to the blue rows, but the formula for the row I use for totals(highlighted in image below) doesn’t copy to the empty adjacent cell in the just added new column.

    excelB.JPG

    How do I fix this? So that each time I add a new judge (new column), the formula from the total row automatically appears in the adjacent cell of the new column as highlighted?

    Also, if this can be done with a macro I would really appreciate this.

    Thanks.

    p.s: I'm a newcomer to the forum please forgive my scrappy images.
    Attached Files Attached Files
    Last edited by Chinoxl; 05-14-2020 at 02:56 PM.

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Automatically copy formula into adjacent cell when a new column is inserted

    O5 =SOM($F5:INDIRECT(ADRES(Row(),Column()-1))) and drag down.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    05-14-2020
    Location
    Mauritius
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Automatically copy formula into adjacent cell when a new column is inserted

    Hello,

    here a VBA solution. But here you should not change the position of the table. Else code needs to be amended regarding the cell position.
    Attached Files Attached Files
    Greetings

    Tor


  4. #4
    Registered User
    Join Date
    05-14-2020
    Location
    England
    MS-Off Ver
    2010
    Posts
    13

    Re: Automatically copy formula into adjacent cell when a new column is inserted

    Quote Originally Posted by oeldere View Post
    O5 =SOM($F5:INDIRECT(ADRES(Row(),Column()-1))) and drag down.
    Edited: I have just realised what you were referring to in your comment and how important it is. The formula in the totals column doesn't update to include the new cell when a new column is inserted but "The formula you provided" inserted into the totals column does this perfectly! This is different from what I was originally asking for (which MRUTOR has helped with), but thanks to you for noticing this as I would not have guessed the SUM formula would not automatically take this in the totals column without =SUM($F5:INDIRECT(ADDRESS(Row(),Column()-1))), this has really saved me from calculation errors, thanks alot Oeldere.
    Last edited by Chinoxl; 05-14-2020 at 02:59 PM. Reason: I have had to come back to this as it is really important

  5. #5
    Registered User
    Join Date
    05-14-2020
    Location
    England
    MS-Off Ver
    2010
    Posts
    13

    Re: Automatically copy formula into adjacent cell when a new column is inserted

    Quote Originally Posted by MRUTOR View Post
    Hello,

    here a VBA solution. But here you should not change the position of the table. Else code needs to be amended regarding the cell position.
    You are a genuis! Exactly what I was looking for! Thanks alot!!!!!

  6. #6
    Registered User
    Join Date
    05-14-2020
    Location
    Mauritius
    MS-Off Ver
    Office 365
    Posts
    97

    Re: Automatically copy formula into adjacent cell when a new column is inserted

    You are welcome. Thanks for the compliment.

  7. #7
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Automatically copy formula into adjacent cell when a new column is inserted

    @Chinoxl

    Add this formula in O5.

    After that add a new column.,

    Imput a value in the new column.

    See what will happen in (new cell) P2 (the value will change).


    Please reply your comment after you have tried that.

  8. #8
    Registered User
    Join Date
    05-14-2020
    Location
    England
    MS-Off Ver
    2010
    Posts
    13

    Re: Automatically copy formula into adjacent cell when a new column is inserted

    Thanks Oeldere, I have edited my previous comment.
    Last edited by Chinoxl; 05-14-2020 at 02:58 PM.

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Automatically copy formula into adjacent cell when a new column is inserted

    Thanks for the rep.

    Glad I could help.

    Thanks for marking the question 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. [SOLVED] How to enter formula from one sheet to another automatically
    By cld7262011 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 12-18-2014, 11:03 AM
  2. Replies: 2
    Last Post: 08-21-2014, 11:35 AM
  3. Automatically Fill in Formula as you enter data
    By leftrightleft in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2014, 05:54 PM
  4. Automatically enter date into a column and make that column read only
    By Mr Davo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-24-2012, 07:58 PM
  5. Macro to automatically enter column header information
    By bradlehoux in forum Excel General
    Replies: 1
    Last Post: 10-15-2011, 12:02 PM
  6. [SOLVED] enter item code in one column, automatically get description in ne
    By Shelley Kingston in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-19-2006, 07:35 AM
  7. [SOLVED] when I enter 12.50 in a column, it automatically changes to 13?
    By Suzette in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-02-2006, 10:20 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