How to sort dynamic data in Microsoft Excel?

Let's say you are managing the storage data of a stationary shop in Excel, and you need to automatically sort the storage data when it changes. How do you sort the dynamic storages data automatically in Excel? This article will show you a tricky way to sort dynamic data in Excel, and keep the sorting update automatically when the original data changes at once.

Sort synamic data in Excel with formula


You may interest in:

Combine multiple worksheets/workbooks into one worksheet / workbook:

Combine multiple worksheets or workbooks into one single worksheet or workbook may be a huge task in your daily work. But, if you have Kutools for Excel, its powerful utility – Combine can help you quickly combine multiple worksheets, workbooks into one worksheet or workbook.


arrow blue right bubble Sort synamic data in Excel with formula


1. Insert a new column at the beginning of the original data. Here I insert column No. before the original data as below screenshot shown:

2. Follow our example, enter formula =RANK(C2,C$2:C$6) in Cell A2 to sort original products by their storage, and press the Enter key.

3. Keep selecting cell A2, drag the Fill Handle down to cell A6 to get all rest numbers in No. column.

4: Copy the titles of the original data, and then paste them besides original table, such as E1:G1. In the Desired No. column, insert the sequence numbers same as the No. orders such as 1, 2, …. See screenshot:

5. Enter formula =VLOOKUP(E2,A$2:C$6,2,FALSE) into Cell F2, and press the Enter key.

This formula will look for the value of Desired NO. in the original table, and display the corresponding product name in the cell.

Note: If repeats or ties display in the Product column or Storage column, you’d better apply this function =IFERROR(VLOOKUP(E2,A$2:C$6,2,FALSE), VLOOKUP(E2,A$2:C$6,2,TRUE))

6. Keep selecting cell F2, drag the Fill Handle down to cell F6 to get all product names, And keep selecting range F2:F6, drag the Fill Handle right to range G2:G6 to get all storage numbers.

Then you will get a new storage table sorting in descend order by the storage as below screenshot shown:

Supposing your stationary shop purchases another 145 pens, and now you have 200 pens in total. Just modify the original table of pen's storage, you will see the new table is updated in a blink of eyes, see the following screen shot:

 

Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1 Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1 200 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more btn download btn purchase

Comments  

Permalink +1 Johann
Hi,

I can do the same without Kutools and in your example iso changing the amount for pencils, you can add another line, repeat pencils and add the additional amount and my spreadsheet will display pencils only once (it does not matter how many pencil entries there are)with the total amount. Plain Excel without Macros, VB Code, Access, D Base, etc. I would love to show you.
2013-10-17 04:25 Reply Reply with quote Quote
Permalink +1 SteveB90
I tried this and it worked as long as all of the ranked values are unique. If there is a tie in the ranking, the VLOOKUP will return #N/A. This creates a problem because I cannot ensure there will not be any ties in my ranking as the values change. In other words, if "Pencil" and "Notebook" are both equal to 80, then RANK returns 1,2,3,3,5. And since the values in the Desired No. field were mannually entered as 1,2,3,4,5, VLOOKUP will not find a "4".
2013-11-11 17:34 Reply Reply with quote Quote
Permalink +1 HelloKelly
Hi SteveB90,
Thanks for your comment. The =VLOOKUP(E2,A$2 :C$6,2,FALSE) will match the data exactly, so it goes wrong if ties happen.

In this case, you can try the approximate matching function =IFERRO R(VLOOKUP(E2,A$ 2:C$6,2,FALSE), VLOOKUP(E2,A$2: C$6,2,TRUE)), which work well if ties come out. And hope it works for you.
2013-11-12 02:34 Reply Reply with quote Quote
Permalink +28 Kedirech
Instead of just using '=RANK(C2,C$2:C $6)' in column A, you can use '=RANK(C2,C$2:C $6) + COUNTIF(C$2:C2, "="&C2)-1' This will go by the rank, but then count the number of duplicates that are already in the list. This will ensure that you get a unique ranking.
2013-11-25 15:45 Reply Reply with quote Quote
Permalink +2 Uttam Saini
Thanks Kedirech..this solved my problem
2015-05-30 07:53 Reply Reply with quote Quote
Permalink 0 Daniel Alfano
Thanks Kedirech!!! This COUNTIF solved the tie issue!!
2015-10-29 18:04 Reply Reply with quote Quote
Permalink 0 Thomas
Kedirech, thank you SOOOO much, this worked perfectly.
2016-05-28 23:53 Reply Reply with quote Quote
Permalink +1 StayLens
can you have multiple ranking columns in excel and use the sort function to be able to rank in numerical order
2014-01-04 03:48 Reply Reply with quote Quote
Permalink 0 Gaz
hi just wanted to say thanks for this page! have been searching the web for a week and this page (plus Kedirech's comment) has solved it!! cheers!
2014-02-10 11:58 Reply Reply with quote Quote
Permalink 0 Fanynn
what if there are more than 2 repeats in storage column? it doesn't work well with the '=IFERROR(VLOOK UP(E2,A$2:C$6,2 ,FALSE), VLOOKUP(E2,A$2: C$6,2,TRUE))' method
2014-02-13 17:26 Reply Reply with quote Quote
Permalink 0 Charles
Did you ever get an answer on this? I've got the same problem when I have 3 or more values that are the same.
2014-04-09 14:15 Reply Reply with quote Quote
Permalink -1 Mandla
Great help guys. thank you.
2014-03-07 08:14 Reply Reply with quote Quote
Permalink +2 Will
Hi, I am using this to make a dynamic league ladder, is there anyway to have multiple teams have the same ranking. For example, if 5 teams have 4 points and 5 teams have 0 points, the vlookup will only lookup the first of each.

This is the raw data:
Pos. Team P W L Pts
1 Team 1 1 1 0 4
6 Team 2 1 0 1 0
1 Team 3 1 1 0 4
6 Team 4 1 0 1 0
1 Team 5 1 1 0 4
6 Team 6 1 0 1 0
1 Team 7 1 1 0 4
6 Team 8 1 0 1 0
1 Team 9 1 1 0 4
6 Team 10 1 0 1 0

This is the vlookup table of the table above:
Pos. Team P W L Pts
1 Team 1 1 1 0 4
2 #N/A #N/A #N/A #N/A #N/A
3 #N/A #N/A #N/A #N/A #N/A
4 #N/A #N/A #N/A #N/A #N/A
5 #N/A #N/A #N/A #N/A #N/A
6 Team 2 1 0 1 0
7 #N/A #N/A #N/A #N/A #N/A
8 #N/A #N/A #N/A #N/A #N/A
9 #N/A #N/A #N/A #N/A #N/A
10 #N/A #N/A #N/A #N/A #N/A



Please help! Thanks a million :D
2014-03-16 07:58 Reply Reply with quote Quote
Permalink 0 DIEGO MEDINA
IM USING THIS FORMULA
=IFERROR(VLOOKUP(I3,CALCULATIONS!I$2:K$7,2,FALSE),(VLOOKUP(I3,CALCULATIONS!I$2:K$7,2,TRUE)))

Now I have a problem... If 2 or more people have the same points, excel repeats the name. What should I add in the formula to avoid repeated names when they have the same amount of points?

Thank you
2014-04-10 19:34 Reply Reply with quote Quote
Permalink 0 Basit
hi guys, this page is really useful. I need an excel formula or vb code what works fine for problem. my problem is that i have a list of numeric range, lets say, 1 to 100 in ascending order in column A. I have the same numeric range in random order in column B and I have different scores in column C in random order. All i want is to sort the random range of column C with the same number against it in column C according to the ascending order of range in column A.I want to sort column B but along with scores in column C as well. for example,
Column A Column B Column C
1
2 10 25
3 4 60
4 9 95
5 2 30
6
7 6 20
8 5 31
9 3 45
10 1 55
in column B, there are two digits (7 &8) missing. i just want that column B be sorted against each digit in column A, like 1 in front of 1 and 2 in front 2 and missing should remain blank in column B in front of 7 & 8 in column A.
Column A Column B Column C
1 1 55
2 2 30
3 3 45
4 4 60
5 5 31
6 6 20
7
8
9 9 95
10 10 25

I hope i have complicated it a lot but plz somebody help me out.
2014-05-28 18:23 Reply Reply with quote Quote
Permalink 0 jays
#Basit - I would like to see a solution without vbasic or macros.
2014-05-29 05:10 Reply Reply with quote Quote
Permalink 0 Basit
#jays,- i would appreciate any solution with or without vbasic or excel formulas.
2014-05-29 16:49 Reply Reply with quote Quote
Permalink 0 jays
If the figures in A and B are always be going to be unique (no duplicate per column and each one in Coln B also appears in A) then it should be fairly easy.
2014-05-30 04:47 Reply Reply with quote Quote
Permalink 0 jays
Numbers in a must be unique and those in b must also spat in a
2014-05-30 04:50 Reply Reply with quote Quote
Permalink 0 Jim101
Thank you for this help. I have one problem. This Ranks things from largest to smallest. I need to do the opposite and rank them smallest to largest. How do I change this.
2014-06-08 16:50 Reply Reply with quote Quote
Permalink 0 Kedirech
Quoting Jim101:
Thank you for this help. I have one problem. This Ranks things from largest to smallest. I need to do the opposite and rank them smallest to largest. How do I change this.
The rank function has an optional 3rd argument. By default it's set to order largest to smallest. But if you use 1 for the 3rd argument, RANK(C2,C$2:C$6 ,1), it will sort in the opposite order.
2014-06-11 13:11 Reply Reply with quote Quote
Permalink 0 Hepp
Hi

I am trying to create a dart averages table, for multiple teams,so that each match when I enter data it automatically calculates on another page on the same sheet.
Rank Name Pl W L 100+ 140+ 180 Av D/Av
2014-07-17 13:55 Reply Reply with quote Quote
Permalink 0 Beast101za
Hi I am finding the Above useful in 2007 however the Company I work for still only uses office 97 will this work in that.

Kind Regards
2014-08-01 13:16 Reply Reply with quote Quote
Permalink 0 jays
Hi Help ,have you tried a pivot table?
2014-08-04 06:56 Reply Reply with quote Quote
Permalink 0 Domz
Thank You so much, it works and best partnered with Graphs!
2014-09-12 22:04 Reply Reply with quote Quote
Permalink 0 GernB
This method can eliminate duplicates without a macro for cases like the example when integers or fixed decimals are used. Add a dummy column and make incremental changes to the data to be sorted. Then follow the same process as outlined using the modified data. Using the example make column I with the formula col C + col E * 0.01. Then, change col A to rank col I instead of col C. The rest is the same. Not perfect but might help. If there are lot of items then decrease the incremental multiplier enough that the max number of items being sorted * the multiplier remains insignificant compared to the data being sorted.
2014-09-25 10:44 Reply Reply with quote Quote
Permalink 0 kevinbmfs
I need help.. I have been using vlookup in excel to look at two sheets (one sheet is from a manufacture, one sheet is from our retail sales software) which share a common vendor number in order to attach a UPC number from the manufacturer info sheet to the retail sales sheet which is then imported back in to our retail sales software. V Lookup errors all to often and I am not savy enough to know why so I was wondering if Kutools has a similar function to make my life easier.
Again,in an attempt to clarify...Manuf acture provided excel sheet contains a vendor number and a UPC number. second sheet has same vendor number and internal part number and I want a Kutool function that will compare vendor numbers and attach the UPC to the second sheet which will then be imported back into our system (using internal part number to "find" the item)
Any help will be appreciated!! :-)
2014-10-11 01:13 Reply Reply with quote Quote
Permalink 0 trader8110
Another option I have found to eliminate an error message due to duplicates. Modify the rank formula a little bit. For the example above:

Original Formula for A2:
=RANK(C2,C$2:C$6)
Revised Formula for A2:
=RANK(C2,C$2:C$6)+(IF(C2=C1,1,0))

Then copy that formula down for all the cells in the A column.
2014-10-29 14:51 Reply Reply with quote Quote
Permalink 0 Pbca ER
I see some people having trouble with the repeated values. For example, what happens if two or more products have same storage count.
=RANK would then Show the list 1,1,3,4,5 etc. So whenever you make a VLOOKUP search it would skip the skipped number, which is 2 in our example.
Here is the solution. =VLOOKUP(SMALL(range;n);range;column;FALSE).
SMALL formula goes finds the n th smallest value in the list. And it catches the repeated values also. Altough there is not actually a 2nd value in our sample, it goes finds the repeated 1st value.
Hope this helps.
2014-11-06 07:01 Reply Reply with quote Quote
Permalink 0 CHENET
Very helpful. It will help me solve problems at work and at church, specifically in Sunday school.
2014-11-30 03:35 Reply Reply with quote Quote
Permalink +1 OptimusPrime
Guys,
Check this out for a better solution and Do as i write:

Step1: Enter serial no 1 to 10 in cells A1 to A10 (S.No.).
Step2: Enter any values in cells B1 to B10 (Item Qty.).
Step3: Enter any object names in cells C1 to C10 (Item Name).
Step4: Enter formula =RANK(B4,B$4:B$ 16)+COUNTIF(B$4 :B4,"="&B4)-1 in cell D1. Drag till D10. (Item position)
Step5: Enter formula =C4 in E1 and drag till E10. (Item Name as is)
Step6: Enter formula =LARGE($B$4:$B$ 16,A4) in F1 and drag till F10. (Desired Item qty. in order)
Step7: Enter formula =IFERROR(VLOOKU P(A4,D$4:E$16,2 ,FALSE), VLOOKUP(A4,D$4: E$16,2,TRUE)) in cell G1 and drag till G10. (Desired Item Name in order).

Watch carefully, Your Desired Item qty. and item name would be in Cell F1 to G10.

If still got problem, download the excel sheet, its protected and the password is password. change value in current cell and press Enter. Watch the last two columns.

And if Still in problem ? let me know.
2015-01-27 22:47 Reply Reply with quote Quote
Permalink +2 xyz
Hello All,

please use below instead of just Rank...

=RANK(C2,C$2:C $6) + COUNTIF(C$2:C2,C2)-1


works every time. Thanks to OptimusPrime!
2015-02-02 04:31 Reply Reply with quote Quote
Permalink 0 OptimusPrime
Sorry Guys, there was a mistake in my previous post.
The correct one is as follows:

Step1: Enter serial no 1 to 10 in cells A1 to A10 (S.No.).
Step2: Enter any values in cells B1 to B10 (Item Qty.).
Step3: Enter any object names in cells C1 to C10 (Item Name).
Step4: Enter formula =RANK(B1,B$1:B$ 10)+COUNTIF(B$1 :B1,"="&B1)-1 in cell D1. Drag till D10. (Item position)
Step5: Enter formula =C1 in E1 and drag till E10. (Item Name as is)
Step6: Enter formula =LARGE($B$1:$B$ 10,A1) in F1 and drag till F10. (Desired Item qty. in order)
Step7: Enter formula =IFERROR(VLOOKU P(A1,D$1:E$10,2 ,FALSE), VLOOKUP(A1,D$1: E$10,2,TRUE)) in cell G1 and drag till G10. (Desired Item Name in order).

Watch carefully, Your Desired Item qty. and item name would be in Cell F1 to G10.
2015-02-03 04:22 Reply Reply with quote Quote
Permalink +1 Amin Mehedi
step 1 to 6 works fine. but step 7 returns "#NAME?". plz check.
2015-02-16 11:46 Reply Reply with quote Quote
Permalink 0 jays
You can do this (and much more) with the correct combination of If statements in any version of Excel. Only you imagination limits your capability.
Jays
2015-02-17 14:32 Reply Reply with quote Quote
Permalink 0 jays
Hi, I do it with if statements alone, how do I let you look at my file?
2015-02-26 20:27 Reply Reply with quote Quote
Permalink 0 Daniel Alfano
Kedirech, you rock!! The COUNT thing eliminates ties!! I've had this problem for years but now this is the solution!! Thanks!!
2015-10-29 18:02 Reply Reply with quote Quote
Permalink 0 indrajit
how can i sort lowest to highest value (a to z) in your example i.e lowest storage to highest storage. i use your formulla '=RANK(C2,C$2:C $6) + COUNTIF(C$2:C2, "="&C2)-1'" & "=IFERROR(VLOOK UP(E2,A$2:C$6,2 ,FALSE), VLOOKUP(E2,A$2: C$6,2,TRUE))" . al is going well but i cannot sort lowest to highest.
2015-11-05 07:06 Reply Reply with quote Quote
Permalink 0 Eli
Hi Dear,
I have a sheet with 100 items , each item has a specific cost that happens in one year .I want to create another sheet that shows only the item that has cost in one year automatically ? for example all of the item with item No. and description and cost in 2016 and then for 2017 and so on...

thanks
2015-11-20 16:41 Reply Reply with quote Quote
Permalink 0 Jays
Hi, no problem, email me and I will show hulu how the finished product works.
2015-11-26 14:41 Reply Reply with quote Quote
Permalink 0 Jays
Sure, mail me the detail and I will show you the finished product
2015-11-26 14:44 Reply Reply with quote Quote
Permalink 0 sourabha
i need to convert a number into another format.lets take an example - no =12394567 i need to convert it into 674501239. its simple (last 2 digit in first ,then 2nd last 2 digits then add a zero(0) then first four digits in the last. can you please guys tell me the formula for this?
2016-06-24 09:00 Reply Reply with quote Quote
Permalink 0 OptimusPrime
you can use the CONCATENATE and then LEFT or RIGHT in excel formula.
Its easy, Got it ?
2016-08-11 16:46 Reply Reply with quote Quote
Permalink 0 Matthew Ritchey
If you're just wanting to sort multiple rows of numbers see this post by PC Magazine

http://www.pcmag.com/article2/0,2817,1215343,00.asp
2017-05-28 16:01 Reply Reply with quote Quote

Add comment


Security code
Refresh