Keep dynamic data sorted

nelsok

Board Regular
Joined
Jan 20, 2006
Messages
166
The only thing i can think of to make my dynamic data always be sorted is to use a formula to sort it.

Does anyone have a formula for sorting data in descending order?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638
Hi,

Try:

C2: =SUMPRODUCT(--(A2<$A$2:$A$10))+COUNTIF($A$2:A2,A2)
D2: =INDEX($A$2:$A$10,MATCH(ROW()-ROW($D$1),$C$2:$C$10,0))

Both dragged down.
Book1
ABCD
1List1RankSorted list
2q3x
3a6t
4c4q
5x1c
6c5c
7a7a
8259a
9t2a
10a825
Sheet1
 

nelsok

Board Regular
Joined
Jan 20, 2006
Messages
166
this will work but the only issue I have is that there are other cells associated with the values being sorted... for example a1 has a name b1 has revenue and c1 has expenditure and d1 has b1/c1...


I would want to sort by d1 but still have the correct data associated with each cell.

is this possible?
 

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638
Sure.

Column C is base line. Just use the same formula as in column D, copied to further columns, to refere to the other columns you would like to sort along.
 

nelsok

Board Regular
Joined
Jan 20, 2006
Messages
166
This is working perfectly. However is it possible to get the cells with "" to be at the end of the sort and not the begining?
 

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638
I see.

="" is concidered "larger" than a number.


In my exhibit above, replace the formula in C2 with

=IF(A2<>"",COUNTIF($A$2:$A$10,">"&A2)+COUNTIF($A$2:A2,A2),COUNTA($A$2:$A$10)+1-COUNTIF($A$2:A2,A2))+IF(ISNUMBER(A2),COUNTA($A$2:$A$10)-COUNT($A$2:$A$10)-COUNTBLANK($A$2:$A$10))
 

nelsok

Board Regular
Joined
Jan 20, 2006
Messages
166

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638
I don't see why you should need to take it away. If you have only numbers it should work but with a mix of text and numbers and formula blanks, I get an error without the 1.
 

Forum statistics

Threads
1,171,719
Messages
5,877,120
Members
433,233
Latest member
Haripriya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top