How to sort a table with only formulas?

I have a table (several rows and columns) which I want to sort. All
cells are formulas which references to other cells outside the table I
want to sort. When trying to sort, Excel (both XP and Mac) sorts but a
split second later it goes back to original non-sorted.

Any suggestions? I could put the sheet on a webpage for you to see.

Christian
0
11/5/2003 9:19:24 AM
excel.misc 78881 articles. 5 followers. Follow

4 Replies
351 Views

Similar Articles

[PageSpeed] 18

Christian,

Formulas are sorted based on their value at the time of the sort, but
then are reevaluated as if they were copied from the original cell to
the cell where they end up, which usually means they change.

You can either change all the cell references to absolute references,
which keeps the formulas, or you can copy/pastespecial values prior to
the sort, which would remove all the formulas.  To keep the formulas
and change the cell references to absolute, select your table and run
the macro below.

HTH,
Bernie
MS Excel MVP

Sub ConvertToAbsoluteReferences()
  Dim myCell As Range
  Dim storedCalc As Variant
  With Application
  storedCalc = .Calculation
  .ScreenUpdating = False
  .EnableEvents = False
  .Calculation = xlCalculationManual
   For Each myCell In Selection.SpecialCells(xlCellTypeFormulas)
       myCell.Formula = Application.ConvertFormula( _
        myCell.Formula, xlA1, xlA1, xlAbsolute)
   Next myCell
  .ScreenUpdating = True
  .EnableEvents = True
  .Calculation = storedCalc
End With
End Sub


"Christian Borchgrevink-Lund" <borchgrevink@yahoo.com> wrote in
message news:18aac9f3.0311050119.1f868913@posting.google.com...
> I have a table (several rows and columns) which I want to sort. All
> cells are formulas which references to other cells outside the table
I
> want to sort. When trying to sort, Excel (both XP and Mac) sorts but
a
> split second later it goes back to original non-sorted.
>
> Any suggestions? I could put the sheet on a webpage for you to see.
>
> Christian


0
deitbe (120)
11/5/2003 12:56:41 PM
Thanks. That solved it!


"Bernie Deitrick" <deitbe@consumer.org> wrote in message
news:eWLMDx5oDHA.976@tk2msftngp13.phx.gbl...
> Christian,
>
> Formulas are sorted based on their value at the time of the sort, but
> then are reevaluated as if they were copied from the original cell to
> the cell where they end up, which usually means they change.
>
> You can either change all the cell references to absolute references,
> which keeps the formulas, or you can copy/pastespecial values prior to
> the sort, which would remove all the formulas.  To keep the formulas
> and change the cell references to absolute, select your table and run
> the macro below.
>
> HTH,
> Bernie
> MS Excel MVP
>
> Sub ConvertToAbsoluteReferences()
>   Dim myCell As Range
>   Dim storedCalc As Variant
>   With Application
>   storedCalc = .Calculation
>   .ScreenUpdating = False
>   .EnableEvents = False
>   .Calculation = xlCalculationManual
>    For Each myCell In Selection.SpecialCells(xlCellTypeFormulas)
>        myCell.Formula = Application.ConvertFormula( _
>         myCell.Formula, xlA1, xlA1, xlAbsolute)
>    Next myCell
>   .ScreenUpdating = True
>   .EnableEvents = True
>   .Calculation = storedCalc
> End With
> End Sub
>
>
> "Christian Borchgrevink-Lund" <borchgrevink@yahoo.com> wrote in
> message news:18aac9f3.0311050119.1f868913@posting.google.com...
> > I have a table (several rows and columns) which I want to sort. All
> > cells are formulas which references to other cells outside the table
> I
> > want to sort. When trying to sort, Excel (both XP and Mac) sorts but
> a
> > split second later it goes back to original non-sorted.
> >
> > Any suggestions? I could put the sheet on a webpage for you to see.
> >
> > Christian
>
>


0
11/6/2003 6:32:46 PM
Well, not completely. The first time I sort the table it works. But the
second time, some values are placed completely wrong. The column from which
I sort is in the middle of the table...

Christian


"Christian Borchgrevink-Lund" <borchgrevink@yahoo.com> wrote in message
news:itwqb.24666$BD3.4590500@juliett.dax.net...
> Thanks. That solved it!
>
>
> "Bernie Deitrick" <deitbe@consumer.org> wrote in message
> news:eWLMDx5oDHA.976@tk2msftngp13.phx.gbl...
> > Christian,
> >
> > Formulas are sorted based on their value at the time of the sort, but
> > then are reevaluated as if they were copied from the original cell to
> > the cell where they end up, which usually means they change.
> >
> > You can either change all the cell references to absolute references,
> > which keeps the formulas, or you can copy/pastespecial values prior to
> > the sort, which would remove all the formulas.  To keep the formulas
> > and change the cell references to absolute, select your table and run
> > the macro below.
> >
> > HTH,
> > Bernie
> > MS Excel MVP
> >
> > Sub ConvertToAbsoluteReferences()
> >   Dim myCell As Range
> >   Dim storedCalc As Variant
> >   With Application
> >   storedCalc = .Calculation
> >   .ScreenUpdating = False
> >   .EnableEvents = False
> >   .Calculation = xlCalculationManual
> >    For Each myCell In Selection.SpecialCells(xlCellTypeFormulas)
> >        myCell.Formula = Application.ConvertFormula( _
> >         myCell.Formula, xlA1, xlA1, xlAbsolute)
> >    Next myCell
> >   .ScreenUpdating = True
> >   .EnableEvents = True
> >   .Calculation = storedCalc
> > End With
> > End Sub
> >
> >
> > "Christian Borchgrevink-Lund" <borchgrevink@yahoo.com> wrote in
> > message news:18aac9f3.0311050119.1f868913@posting.google.com...
> > > I have a table (several rows and columns) which I want to sort. All
> > > cells are formulas which references to other cells outside the table
> > I
> > > want to sort. When trying to sort, Excel (both XP and Mac) sorts but
> > a
> > > split second later it goes back to original non-sorted.
> > >
> > > Any suggestions? I could put the sheet on a webpage for you to see.
> > >
> > > Christian
> >
> >
>
>


0
11/6/2003 8:51:48 PM
Christian,

Send me a _small_ version of your spreadsheet - just enough rows to show the
problem - and I will take a look.

HTH,
Bernie
MS Excel MVP

"Christian Borchgrevink-Lund" <borchgrevink@yahoo.com> wrote in message
news:Evyqb.24699$BD3.4591435@juliett.dax.net...
> Well, not completely. The first time I sort the table it works. But the
> second time, some values are placed completely wrong. The column from
which
> I sort is in the middle of the table...
>
> Christian
>
>
> "Christian Borchgrevink-Lund" <borchgrevink@yahoo.com> wrote in message
> news:itwqb.24666$BD3.4590500@juliett.dax.net...
> > Thanks. That solved it!
> >
> >
> > "Bernie Deitrick" <deitbe@consumer.org> wrote in message
> > news:eWLMDx5oDHA.976@tk2msftngp13.phx.gbl...
> > > Christian,
> > >
> > > Formulas are sorted based on their value at the time of the sort, but
> > > then are reevaluated as if they were copied from the original cell to
> > > the cell where they end up, which usually means they change.
> > >
> > > You can either change all the cell references to absolute references,
> > > which keeps the formulas, or you can copy/pastespecial values prior to
> > > the sort, which would remove all the formulas.  To keep the formulas
> > > and change the cell references to absolute, select your table and run
> > > the macro below.
> > >
> > > HTH,
> > > Bernie
> > > MS Excel MVP
> > >
> > > Sub ConvertToAbsoluteReferences()
> > >   Dim myCell As Range
> > >   Dim storedCalc As Variant
> > >   With Application
> > >   storedCalc = .Calculation
> > >   .ScreenUpdating = False
> > >   .EnableEvents = False
> > >   .Calculation = xlCalculationManual
> > >    For Each myCell In Selection.SpecialCells(xlCellTypeFormulas)
> > >        myCell.Formula = Application.ConvertFormula( _
> > >         myCell.Formula, xlA1, xlA1, xlAbsolute)
> > >    Next myCell
> > >   .ScreenUpdating = True
> > >   .EnableEvents = True
> > >   .Calculation = storedCalc
> > > End With
> > > End Sub
> > >
> > >
> > > "Christian Borchgrevink-Lund" <borchgrevink@yahoo.com> wrote in
> > > message news:18aac9f3.0311050119.1f868913@posting.google.com...
> > > > I have a table (several rows and columns) which I want to sort. All
> > > > cells are formulas which references to other cells outside the table
> > > I
> > > > want to sort. When trying to sort, Excel (both XP and Mac) sorts but
> > > a
> > > > split second later it goes back to original non-sorted.
> > > >
> > > > Any suggestions? I could put the sheet on a webpage for you to see.
> > > >
> > > > Christian
> > >
> > >
> >
> >
>
>


0
deitbe (120)
11/6/2003 10:37:52 PM
Reply:

Similar Artilces:

Where's the Sort by New Message option?
Not sure when the layout of the newsgroups changed but I can't seem to find the ability to sort by new message in a thread instead of sorting by just the original thread date. That was hugely helpful as I could follow along and see what threads were still active. If you're gonna hang around in the newsgroups (any newsgroups), you may want to start using a newsreader. Microsoft Outlook Express can do it for you. Saved from a previous post: You may want to connect to the ms newsserver directly: If you have Outlook Express installed, try clicking on these links (or copy and paste i...

Sorting
Hi, is it possible to use variable for sorting? Something like: declare @sort varchar(10) SET @sort='column1 DESC' SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table Is dynamic SQL only option? Thank you, Simon On 15/04/2010 11:28, simon wrote: > Hi, > > is it possible to use variable for sorting? > > Something like: > > declare @sort varchar(10) > SET @sort='column1 DESC' > > SELECT ROW_NUMBER() OVER (ORDER BY @sort)AS rowId, * FROM table > > Is dynamic SQL only option? You can use CASE to he...

How to sort account list?
I'm using MS Money 2004 Small Business. In the account list, my accounts are catagorized by and in this order: - bank accounts - credit accounts - investment accounts - loans and liabilities - asset accounts TOTAL BALANCE In the above view, I cannot easily determine totals for assets and liabilities. The following view does this. - bank accounts - investment accounts - asset accounts SUBTOTAL -loans and liabilities SUBTOTAL TOTAL BALANCE How do I get the above view? Thanks, Brett I don't use Small Business. But you can run a Net Worth report to get total assets and ...

Formula to return the name of a tab?
We have a spreadsheet set up that pulls the minimum value from several different tabs. We are looking for a formula or a way to display, in the next column, which tab that minimum value came from. Does anyone have any ideas? You might check the Help files for information on the SHEETNAME function. Ed "Amanda" <anonymous@discussions.microsoft.com> wrote in message news:54F7CB4F-A621-4DB0-9963-56F0406EE8F1@microsoft.com... > We have a spreadsheet set up that pulls the minimum value from several different tabs. We are looking for a formula or a way to display, in the next...

Row names will not move with sort
Each row in my summary table in Sheet1 is hyperlinked to a corresponding table in Sheet2 with additional details. I need to move the rows in my summary table (Sheet1) and preserve the links to and from the details tables (Sheet2). I found that I can move rows in Sheet1 with cut & insert and the hyperlinks are maintained. I can travel from a row in summary table (Sheet1) to details table (Sheet2) and back, even after the corresponding row (Sheet1) was moved. But if I sort the rows in Sheet1 the links from Sheet2 back to corresponding rows in Sheet1 lead to presorted locations. Apparen...

set default record to a table
I have a shared db with various front ends (mde). I would like to set a paricular record as my default record, so whenever someone opens up the various db forms it opens up to the same default record. Is this possible? Maybe this is a matter of terminology... In Access, data is stored in tables. Each table has it's own records (collections of related data). When you say you want a "record" to be the default one pulled up by everyone, how do you know they are all using their different forms to look at the same data (i.e., table)? Next, why? What is it about ...

formula to update todays date in excell automatically daily
formula to update todays date in excell automatically daily =NOW() or =TODAY() -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Vishal" <Vishal@discussions.microsoft.com> wrote in message news:1065C8D9-220E-4071-AEEC-B3ECE6593D1D@microsoft.com... > formula to update todays date in excell automatically daily ...

Call value from table not form
I am probably overlooking something stupid here but, I need to pull a value from a table when a form is not open? Dim InternalEmail As String InternalEmail = Forms!frmCommitteeEmail!DMEmail this gives an error if the form frmCommitteeEmail is not already open. I am pretty sure that is the problem because if I add code to first open the form it works fine. Any help here will be appreciated. Thanks in advance Dave wrote: > I am probably overlooking something stupid here but, I need to pull a > value from a table when a form is not open? > > Dim InternalEmail As String > I...

sorts not sorting
OK- Thanks to everyones help I now i have a list i can work with... but there are a few problems.... the zips are all 5 digit and now i have to sort them... the problem is, THEY WONT SORT CORRECTLY!!!!!!! The numbers are not in order... some are but a lot are not... is there anyway to fix this???? i need to sort them by zip code but cant seem to get them to do it correctly.. any ideas??? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ You are going to be far better of...

How do I return the table structure using an SQL command in a quer
In a VBA function, I need to fill a combo box with the table fields name. Could you please help me on this? -- Wagner Mokva You've described "how" you are trying to do something. If you'll describe "why" you want to do this, the newsgroup readers may be able to offer more specific suggestions. Regards Jeff Boyce Microsoft Office/Access MVP "Wagner Mokva" <WagnerMokva@discussions.microsoft.com> wrote in message news:40D27041-8E53-4BAB-B31D-C75FA935B28A@microsoft.com... > In a VBA function, I need to fill a combo box with the table fields...

Budget vs. Spending table
I'm switching from Money 2005 to 2007. In the 2005 version, under "Budget Summary" on the left sidebar from the Home page was a link to a report/table called "Budget vs. Spending. The table eas titled "Compare Actual Spending to Your Budget" and near the top had a drop down box to select the time period for the table. Below the table had the actual categories, spending, budget and difference in columns. Order was by category. I can't find this same table/report in 2007. Closest is viewing "Monthly Budget report - similar layout but no time choi...

import- number- sort?
I imported this data into a spread sheet- I tried to format it to number, but when I sort it- I get : 37.08 4.33 4.79 4.8 42.56 5.94 Whats up with this? Thanks Brent Hi Brent, Install the TrimAll macro, select the column and invoke the macro from Alt+F8 http://www.mvps.org/dmcritchie/excel/join.htm#trimall Directions to install and use a macro at http://www.mvps.org/dmcritchie/excel/getstarted.htm#havemacro I expect that you have spaces or CHAR(128) "Required Blank" characters in you data you can check is =LEN(A1) --- HTH, David...

date formula #2
Hi i am trying for a way to work out how i can formulate the date, ie. if today is 17 November 2003, i want to import data from date 1 Novemeber 2003 how would i do this and what formulae would i use? any idea ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com =today()-1 GB "jaggosai" <jaggosai.x32sz@excelforum-nospam.com> wrote in message news:jaggosai.x32sz@excelforum-nospam.com... > > Hi i am trying for a way to work out how i can formulate the dat...

Underlining figures in tables
In the past, whenever a document has had columns of dollar amounts and totals, I've always placed a narrow-width column between each regular column so that when underlining the cells above the "Total," in each column, it would not appear as one straight line spanning several columns. However, I've just taken over a long document from someone else who has underlined the last items in the columns before the totals--and the lines do not extend all across the column; in other words, they look like mine, but without all the trouble I've gone through! Please...

Pivot Table
Hi! What is the maximum rows allowed in a data range when using a pivot table? I have a pivot table that uses a data range. When I have only 4581 records in the data range, the pivot table updates with no problems. But, when entering more than 4581, the pivot table won't update and gives me an error. Am I hitting the max on data rows within my data range or is there a work-around. Thanks!! dmotika The following MSKB articles outline PivotTable limitations for different versions of Excel: XL2000: Limits of PivotTables in Microsoft Excel 2000 http://support.microsoft.com/de...

sorting macro #3
I need to sort on 8 cells in a row and on 1500+rows. I can do it one at a time but I know there must be an easier way. Can ANYONE HELP? C3:J3 I need these cells sorted and then down to C1532:J1532 I did create a macro to sort after I selected them but still one at a time. Does it have to be a macro? I can edit a macro but don't really know how to program them. Yes, it has to be a macro. The following should do it. This macro loops through all the entries in Column C, and in each row it sorts the values in Columns C:J. HTH Otto Sub SortRows() Dim rColC As Range Dim i As...

Can we sort a form and also be able to enter new records.
Hi, It is possible to sort the data on a form and also be able to enter new and edit the existing records in it. Cheers! On Tue, 15 Jan 2008 15:41:16 -0800 (PST), Rex wrote: > Hi, > > It is possible to sort the data on a form and also be able to enter > new and edit the existing records in it. > > Cheers! I assume you mean "Is it". The form sort order has nothing to do with editing or adding new records, so the answer is yes. If you cannot edit or add new records, make sure the form's record source, if it is a query, is updateable. Some queries are not. O...

Sorting checking register
How do i sort my check register in Money 2004 Deluxe so that uncleared transactions appear below cleared transactions? In Quicken i could click on the column to provide that sort. In microsoft.public.money, Dean wrote: >How do i sort my check register in Money 2004 Deluxe so >that uncleared transactions appear below cleared >transactions? In Quicken i could click on the column to >provide that sort. You don't. Available choices are chosen by clicking View at the top of the register. ...

Which formula to match string subset?
I'm being obtuse today and can't figure out which formula to use to match the beginning portion of a string. For instance, in a SUMPRODUCT or IF statement I need to be able to identify just those records where the first few characters of value in cell within a named range matches what is specified in the formula. Named Range = Freight Named Range=FtChg GR1234 125.00 2D9879 300.00 GR3467 50.00 SA0009 285.00 GR0099 ...

using addrress books to sort incoming mail
I use address books to sort incoming mail. An odd thing: depending on how the sender's name comes across, it doesn't get caught by the filter (amd moved to the "Family Mail" Folder I have set up. for example: my mom and dad's email (from momanddad@somedomain.com) comes as from that address. However, in my contacts, they are listed by their names: John and Mary Smith, with momanddad@somedomain.com as their email address and John and Mary Smith as the display name. What have I done wrong? TIA 1. The big ONE - failed to post your version of Outlook. Rules operate at ...

Count records from different table
Not sure if this is even do-able or not. I have a form (lets call it FORM A) that has details information about each Case. Each case can have multiple Collection records. I want text box on FORM A that just tells me the number of Collection records with the same Case number. I tried DCount in a new unbound text box, but i just get '#Error'. Any suggestions? You can use an unbound textbox, and in the form's On Current event open a recordset of the table, then populate the textbox with the recordcount from that recordset. For example, if your other table was called TBL an...

Disabled "Switch Row/Column" when creating chart from a pivot tabl
I have a pivot table where there are week numbers and three different data values pr week. This I want to graph so that the weeks are on the X-axis, the values on the Y-axis and a legend telling which of the three datasets are which. When I create a Line graph the weeks are put as a legend and the X-axis have the three different datasets grouped. This is not what I want. When I go into "the "Select data..." dialog box all the options are disabled. Why is this and how can I get the graph to show the way I want? You will need to pivot your pivot table to move the row fiel...

Pivot Table
In a Excel Pivot Table, when we double-click a cell in the Data area, a new sheet is created with the details. What I want to do (I already did it in the past), is when I click a cell in the Row area, several sheets are created (one per value). I have already had this feature in Excel in the past (I think it was an add-on), but I don't remember how to do it again. Thxs,, Pedro Valente I think you mean from the Page field, not the Row field. From the PT Toolbar>dropdown>Show Pages -- Regards Roger Govier "Valente" <pedro.valente.geral@gmail.com> wrote in messag...

What table is the SOPType lookup table?
I'd like to do a sql join from sop tables and rather then hard code the soptype description such as 2=Order, 3=Invoice, 4=Return, I want the join to return the description by getting it from the sop type lookup table. Can't locate the lookup table. Can someone please send me the lookup table. Thanks. Unfortunatlety there is no lookup table for this information. In the past, I have created my own table to serve as a lookup. The table closest to the information you arer looking for is [SOP40300]. -- Regards Andrew Dean Envisage Software Solutions Pty. Ltd. www.envisa...

Unmerge so I can sort
I coy/pasted data into Excell and when I try to sort it I get "This operation requires merged sells to be identically sized". I understadn the work around in KB but how do I find which sells are merged? I wouldn't bother looking. I'd just remove all the merged cells from the range to sort. Select that range format|cells|alignment tab uncheck the merge cells box But if you wanted to search, you can do it via process of elimination. Select a range, format|cells|alignment tab. If that merge cells box is checked, then the whole selection is merged. If it's grey, t...