Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
jonfu
 
Posts: n/a
Default Sorting lists with references


How do a sort a list that contains references/formulas?
(I want the reference to follow the row as it is "sorted around"..)

Excel does't seem to want to sort a list containg formulas, it will
only sort lists with numerical values..

Thanks!


--
jonfu
------------------------------------------------------------------------
jonfu's Profile: http://www.excelforum.com/member.php...o&userid=28193
View this thread: http://www.excelforum.com/showthread...hreadid=477281

  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default Sorting lists with references

janfu,

If you want to sort based on the column of formulas, first copy the column
with the formulas, choose "Insert copied cells" from the right click menu,
then right click and choose paste special, values. That efectively doubles
the column with formulas, but with one as values. IF you want to sort based
on another column, skip this step.

Then choose your cells with the formulas and run this macro:

Sub FormulaToText()
Dim myCell As Range
On Error GoTo NoneFound
For Each myCell In Selection.SpecialCells(xlCellTypeFormulas)
myCell.Formula = "'" & myCell.Formula
Next myCell
NoneFound:
End Sub

This will convert the formulas to strings, so that Excel won't update them.

Then do your sort based on your desired column of values. Then, reselect the
cells that have the formulas that were converted to text, and run this
macro:

Sub TransformToFormula()
Dim myCell As Range
On Error GoTo NoneFound
For Each myCell In Range("A1").SpecialCells(xlCellTypeConstants, 2)
myCell.Formula = myCell.Text
Next myCell
NoneFound:
End Sub

Then delete your extra column of values (if you had inserted them)

HTH,
Bernie
MS Excel MVP


"jonfu" wrote in
message ...

How do a sort a list that contains references/formulas?
(I want the reference to follow the row as it is "sorted around"..)

Excel does't seem to want to sort a list containg formulas, it will
only sort lists with numerical values..

Thanks!


--
jonfu
------------------------------------------------------------------------
jonfu's Profile:
http://www.excelforum.com/member.php...o&userid=28193
View this thread: http://www.excelforum.com/showthread...hreadid=477281



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting 2 lists jtoy Excel Discussion (Misc queries) 1 July 15th 05 03:36 AM
Excel :sorting lists? excelant Excel Discussion (Misc queries) 1 June 20th 05 03:05 AM
Comparing lists of map references simonralph Excel Worksheet Functions 0 April 8th 05 01:18 PM
How can I create drop-down lists with references in other workboo. Cezar DUMITRIU Excel Worksheet Functions 1 March 30th 05 02:15 PM
HELP! Filtering and sorting lists. [email protected] Excel Worksheet Functions 3 March 25th 05 01:31 PM


All times are GMT +1. The time now is 09:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"