+ Reply to Thread
Results 1 to 4 of 4

how to replace all relative references to fixed in a sheet

  1. #1
    Registered User
    Join Date
    05-31-2009
    Location
    Europe
    MS-Off Ver
    Excel 2003
    Posts
    47

    Exclamation how to replace all relative references to fixed in a sheet

    Hi there
    I have like thousands of cells in a sheet with reference or formula with reference that need to be changes to fixed reference (or how do we call it in english - reference in say C1 has to be kept to C1 in the next sheet although I add new rows there

    I quickly need to do it today, I was told before there should be a macro for that but it didn't work.
    So perhaps there's another way or someone could post/refer me to a working macro for that with instructions how to run it ?
    Last edited by przemke; 07-16-2009 at 03:21 AM. Reason: forum rules

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: how to replace all relative references to fixed in a sheet

    reference in say C1 has to be kept to C1 in the next sheet although I add new rows there
    You would need to rewrite your functions I'm afraid... ie instead of:

    =C1

    you would need to use either

    =INDEX(C:C,1)

    or

    =INDIRECT("C1")
    (Indirect is Volatile)

    As rows are added both of the above will continue to reference row 1... INDEX would generate a #REF error if column C were deleted... if that were likely you would need to reference the entire sheet (INDEX(1:65536,1,3) etc...)

    As I see it you have no shortcut available other than perhaps running an Edit Replace and replacing C1 with INDIRECT("C1") but if you have thousands of formulas performance will be affected given Volatile nature of INDIRECT function.

  3. #3
    Registered User
    Join Date
    05-31-2009
    Location
    Europe
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: how to replace all relative references to fixed in a sheet

    Thanks that helps. I did not notice that a fixed reference will change too if a row is added

    How would I replace the rows as you suggest as most of them contain this formula, so the reference is there twice:
    =IF(ISNA(calculations!E11),"",calculations!E11)
    (each for each cell in the "calculations" sheet)
    I mean I was thinking I could do it by find&replace for all cells. I could do that manually for all columns i.e 60 at the moment

    There is about 1/4 of 20000 cells currently relevant with that formula, the rest is blank for now. Would it really slow it down much with INDIRECT?

    But removing certain column would take place too so I think that it's better to just add or remove the column manually at the end :/ ? It will not take place often but I wanted to avoid that for the less skilled people...

  4. #4
    Registered User
    Join Date
    05-31-2009
    Location
    Europe
    MS-Off Ver
    Excel 2003
    Posts
    47

    Re: how to replace all relative references to fixed in a sheet

    Just to add to actual topic question: I attach a macro that does convert all selected columns from fixed to relative and vice versa.
    PS why I cannot edit previous posts ? (I wanted to mark the thread as solved, or do moderator's do it?)
    Attached Files Attached Files

+ 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