Cell reference into sorted table not changed when sorting

If a cell references Table 1::B2 and if I then sort Table 1::B, the value of the cell changes to the new value of B2. This is by design. It doesn't matter if I use B2 or $B$2. MS Excel has the same behaviour.


To clarify: Let's say Table 1::B have 3 cells, with values 1, 2, and 3 respectively. The cell reference to B2 first hence has the value 1, and after descending sort of Table 1::B, the referencing cell has the value 3.


However, I want the behaviour where the cell reference continues pointing to the cell, and hence changes to its new place. After the sort the value hence still is 1, because it references the "same" cell.


How do I achieve this behavior? It might be I'm misusing the spreadsheet in a wrong way here, it's perhaps a question of spreadsheet design:


My Table 1 is ingredients which are sorted by price. Sometimes I add new ingredients, but other tables reference specific ingredients' cells. One workaround is to VLOOKUP the ingredient by name, such that it's not affected by sorting. Not perfect because it hard codes the relative column, but better.


Using Numbers 14.4, macOS Sequoia 15.6.1.

MacBook Air 13″, macOS 15.6

Posted on Sep 6, 2025 03:42 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 21, 2025 12:45 PM

If I am understanding you correctly, I think you need is using it more like a database, which means you need a key column., that you then do a xlookup or vlookup to grab the value you want, (I prefer xlookup now, I avoid vlookups due to the limitations that xlookup addresses). Direct cell references works well with data that isn’t going to be sorted, like a basic budget where everything stays in its place as you enter the weeks data each week.


so if your ingredient is onions, column A is the ingredient name, and column B is quantity, you would look up the onions on column A and bring back the quantity value from B.


hope that helps

jason

3 replies
Question marked as Top-ranking reply

Sep 21, 2025 12:45 PM in response to fenglich

If I am understanding you correctly, I think you need is using it more like a database, which means you need a key column., that you then do a xlookup or vlookup to grab the value you want, (I prefer xlookup now, I avoid vlookups due to the limitations that xlookup addresses). Direct cell references works well with data that isn’t going to be sorted, like a basic budget where everything stays in its place as you enter the weeks data each week.


so if your ingredient is onions, column A is the ingredient name, and column B is quantity, you would look up the onions on column A and bring back the quantity value from B.


hope that helps

jason

Sep 6, 2025 04:56 PM in response to fenglich

It would be nice if we had that as a choice. This was how Numbers did it in its early versions. It did have its pitfalls, though. If your cell reference was a range like in =SUM(Table 1::B1:B10) and you sorted Table 1, you could end up with a long formula with 10 individual references in it, or a mix of ranges and cell references.


XLOOKUP is a choice for following the ingredient name around. VLOOKUP is an old function.

Cell reference into sorted table not changed when sorting

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.