+ Reply to Thread
Results 1 to 6 of 6

Macro to break and then rejoin formula links

  1. #1
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Macro to break and then rejoin formula links

    Hi

    I am really confused how to name this topic but my problem is straight forward.

    I have value 100 in A1 and 50 in B1, note that these values may change later.

    I want the macro to record formula in C2 as "=(100+50)/A2" and not "=(A1+B1)/A2" so that even if later contents of A1 and B1 are changed, C1 still shows "100" and "50" in the formula as =(100+50)/A2.

    I am looking for a Macro code purely based on offset feature as the exact locations of cells can change however relative positions will never change.
    Last edited by caabdul; 03-30-2015 at 09:26 AM.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Offset static Formula

    why a macro? Give the cell a name range, then use that?

    even with VBA or offset or whatever, how would you know how to find the cell?
    Last edited by FDibbins; 03-29-2015 at 04:14 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Offset static Formula

    Hi FDibbins

    "how would you know how to find the cell?" That is the problem. I will only know relative position of the cells as those cells will automatically be produced as a result of Macro Run and later deleted when their purpose is fulfilled.

  4. #4
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Offset static Formula

    In other words I want macro to do following:

    1- In active cell, put formula linked with Upper[-1,0], Upper Left[-1,-1] and Left[0,-1] cells.
    2- Break link with Upper[-1,0] and Upper Left[-1,-1] cells while keep link active with Left[0,-1] cell.

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Offset static Formula

    Maybe ?:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 03-30-2015 at 08:35 AM.

  6. #6
    Forum Contributor
    Join Date
    12-25-2011
    Location
    Lahore, Punjab, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    287

    Re: Offset static Formula

    Hi John, awesome

    This resolves my first part with a small modification. Now my second part is a bit complicated as I want to break partial formula link as elaborated in following examples.

    IF any of following two examples can work, it will work for me.

    EXAMPLE 1
    A1 = 3
    B1 = 4

    Original Formula in Cell C1 will be
    C1 = A1+B1

    I want Macro to change above formula into the following,
    C1 = 3 + B1 (So its link is broken with A1 but not broken with B1)

    EXAMPLE 2
    A1 = 3
    B1 = 4

    Can a macro put a formula in B1 as follows:
    B1 = 4/3*A1
    Last edited by caabdul; 03-30-2015 at 09:17 AM.

+ 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. Replies: 1
    Last Post: 08-12-2013, 08:38 AM
  2. Replies: 2
    Last Post: 08-12-2013, 06:19 AM
  3. Enter static date into offset(0,1) if entry into current cell
    By timtim89 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-08-2012, 05:41 PM
  4. Reformatting - insert formula with offset, then offset to next cell
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2011, 05:41 AM
  5. Static left hand side column and static header row.. how?
    By glic in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-20-2007, 01:45 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