+ Reply to Thread
Results 1 to 11 of 11

How to keep referencing same cell after sorting.

  1. #1
    Forum Contributor
    Join Date
    06-07-2008
    Posts
    126

    How to keep referencing same cell after sorting.

    Hi everyone,

    Say cell A1 has 55
    Cell B1 has the formula =A1

    Sort only column A (the 55 now becomes in a different row)
    Cell B1 chnages value because it is referencing cell A1 which has now a new value.

    I want cell B1 to ALWAYS get the value from that orginal cell (i.e. 55) no mmatter where that cell gets located after sorting.

    INDIRECT, and Nammed Ranges don't seem to do it.

    Thanks.
    Last edited by NBVC; 04-20-2009 at 08:36 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to keep referencing same cell after sorting.

    In another sheet, enter in column A the numbers 1 to whatever your last filled row number in the first sheet is.

    so have a list starting in A1 like:

    1
    2
    3
    4
    5
    ... etc


    then back in your original sheet enter formula in B1:

    =INDEX(A:A,Sheet3!A1) where sheet3!A1 lists the number 1

    and copy down

    Now sort by column A
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    06-07-2008
    Posts
    126

    Re: How to keep referencing same cell after sorting.

    No joy! Cell B1 strill makes reference to A1 and not to the value that used to be in A1.

    Any other ideas?

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: How to keep referencing same cell after sorting.

    You might need VBA for this... can't think of anything right now.

  5. #5
    Forum Contributor
    Join Date
    06-07-2008
    Posts
    126

    Re: How to keep referencing same cell after sorting.

    I am sure there are other ways to do it. BTW I was able to achieve this using cell Comments which hold the cell references and whuch can be read using a user defined function, then with a vlookup formula the value of the original cell can be pulled no matter where that cell is. It works fine but it is not a practical solution for large data lists.

    Anybody else whith some ideas?

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to keep referencing same cell after sorting.

    a messy way is to insert another new column A then number down as far as you want
    in c1 then put =LOOKUP(1,A:A,B:B)
    whenever you sort the old column a(now col b )sort by both col a&b it will always return where the position of 1 i.e the same number
    Last edited by martindwilson; 04-17-2009 at 02:16 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  7. #7
    Forum Contributor
    Join Date
    06-07-2008
    Posts
    126

    Re: How to keep referencing same cell after sorting.

    Nope!
    Returns #N/A after sorting.

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: How to keep referencing same cell after sorting.

    use
    =VLOOKUP(1,A:B,2,FALSE)
    instead

  9. #9
    Forum Contributor
    Join Date
    06-07-2008
    Posts
    126

    SOLVED - Re: How to keep referencing same cell after sorting.

    Brilliant!

    That does it. Thank you very much Martin
    Last edited by matrex; 04-18-2009 at 12:02 PM.

  10. #10
    Registered User
    Join Date
    10-18-2011
    Location
    dhaka, bangladesh
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to keep referencing same cell after sorting.

    Hi, i am also looking for same solution, but i can not make the =VLOOKUP(1,A:B,2,FALSE) right. Can anyone please help?
    Attached Files Attached Files

  11. #11
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,447

    Re: How to keep referencing same cell after sorting.

    Administrative Note:

    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread

+ 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