+ Reply to Thread
Results 1 to 7 of 7

Cell referencing broken on column sorting

  1. #1
    Registered User
    Join Date
    07-16-2014
    Location
    montreal, canada
    MS-Off Ver
    2016
    Posts
    39

    Cell referencing broken on column sorting

    I have a long list of names and numbers that are also associated with some data, some of the data cells reference other data cells in the same column. When i apply filters to the name or number columns the cells that have references are broken.

    I've attached an example of this with a bit more explanation inside.

    How do I keep the references form breaking?

    Thanks for your help.

  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
    52,938

    Re: Cell referencing broken on column sorting

    references always change when you sort. If you want then to always reference C2, then use =indirect("c2")
    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
    Registered User
    Join Date
    07-16-2014
    Location
    montreal, canada
    MS-Off Ver
    2016
    Posts
    39

    Re: Cell referencing broken on column sorting

    i dont want the reference to stay c2 i want it to stay "linked" to Michael's data cell. So if Michael's data is moved to c15, brad's data should now reference c15. excel's calculation just adjust the formula to continue referencing a cell that is the same number of cells as it had originally, ie: Brad's data cell, C4 was equal to C2. After sorting Brad's data cell is C1, and it throws a reference error because it is trying to reference C-1, when really Michael's data cell is now C5 and thus Brad's should be =C5.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Cell referencing broken on column sorting

    If you include the SheetName in the reference formula, it will 'stick' to that cell when sorted.
    i.e. Insted of =C5, try =Sheet1!C5

  5. #5
    Registered User
    Join Date
    07-16-2014
    Location
    montreal, canada
    MS-Off Ver
    2016
    Posts
    39

    Re: Cell referencing broken on column sorting

    That won't work either. I need the reference to update to the new location of the data it is referencing. See my example and sort by number, you will notice that the reference breaks.
    The names are ordered alphabetically when you first open the spreadsheet, brad's data references Michael's data cell; C2=C5. If you sort by number from smallest to largest, Brad's data cell now references C9 when i need it to reference C2 because Michael's data cell is now C2.

  6. #6
    Registered User
    Join Date
    07-22-2016
    Location
    Flagstaff, Arizona
    MS-Off Ver
    2010
    Posts
    9

    Re: Cell referencing broken on column sorting

    Just use Vlookup? =VLOOKUP("Michael",$B:$C,2,FALSE)

  7. #7
    Registered User
    Join Date
    07-16-2014
    Location
    montreal, canada
    MS-Off Ver
    2016
    Posts
    39

    Re: Cell referencing broken on column sorting

    Quote Originally Posted by snick45 View Post
    Just use Vlookup? =VLOOKUP("Michael",$B:$C,2,FALSE)
    That's works perfectly! Thank you!

+ 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. How to keep referencing same cell after sorting.
    By matrex in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-12-2021, 10:05 AM
  2. Cell referencing issue when sorting data
    By lonemascot in forum Excel General
    Replies: 7
    Last Post: 03-10-2015, 10:40 AM
  3. Referencing last cell in a column
    By clh7837 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-23-2014, 06:37 PM
  4. Replies: 0
    Last Post: 01-09-2013, 06:58 AM
  5. Replies: 5
    Last Post: 11-05-2012, 10:48 AM
  6. Replies: 10
    Last Post: 07-12-2010, 08:55 AM
  7. Excel 2007 : Name Ranges Cell Referencing & Sorting
    By Andrew_A in forum Excel General
    Replies: 1
    Last Post: 05-05-2010, 07:43 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