XL: Errors Sorting Cells That Contain References (40401)



The information in this article applies to:

  • Microsoft Excel for Windows 2.0
  • Microsoft Excel for Windows 2.01
  • Microsoft Excel for Windows 2.1
  • Microsoft Excel for Windows 2.10c
  • Microsoft Excel for Windows 2.10d
  • Microsoft Excel for Windows 3.0
  • Microsoft Excel for Windows 3.0a
  • Microsoft Excel for Windows 4.0
  • Microsoft Excel for Windows 4.0a
  • Microsoft Excel for Windows 4.0c
  • Microsoft Excel for Windows 5.0
  • Microsoft Excel for Windows 5.0c
  • Microsoft Excel for Windows NT 5.0
  • Microsoft Excel for Windows 95
  • Microsoft Excel 97 for Windows

This article was previously published under Q40401

SYMPTOMS

In Microsoft Excel, when you sort a column of values that are the result of arithmetic operations based on relative references, you may receive #REF error values.

CAUSE

To correctly sort a range that includes cells with references, all references must be absolute references. Using relative references can result in errors because the references may become invalid when the cells are rearranged in the specified sort order.

For example, given these cells and sorting A1:C3 in ascending order with the sort key being cell A1
   A1: 3  B1: =A3     C1: =$A$3
   A2: 2  B2: =A2     C2: =$A$2
   A3: 1  B3: =A1     C3: =$A$1
				
the resulting formulas are:
   A1: 1  B1: =#REF!  C1: =$A$1
   A2: 2  B2: =A2     C2: =$A$2
   A3: 3  B3: =A5     C3: =$A$3
				
Note that cell B1 is now an invalid reference and that cell B3 has lost its reference to A3 and now refers to A5. The formulas in column C have been correctly sorted.

MORE INFORMATION

For additional information, please click the article numbers below to view the articles in the Microsoft Knowledge Base:

70096 XL: Using FORMULA.CONVERT() to Change Relative/Absolute References

48254 XL: Data Sort Not Sorting Correctly in Excel


Modification Type:MinorLast Reviewed:8/16/2005
Keywords:kbprb KB40401