How to Round and Sort Data using Excel Formulas?

Share

Facebook
Twitter
LinkedIn

Cheryl asks via e-mail,

I was wondering if you could help me figure out how to combine the round formula with the rank formula? I need to first round all the numbers and then rank them. I have tried various ways to do this but they aren’t working properly. I really don’t want to add a column to round and then rank because I need to do this round/rank many times for this particular spreadsheet. There are also merged columns which makes it even more challenging. Before I go through the painstaking efforts to insert columns to round, I thought I’d check with you.

round-and-sort-using-excel-array-formulas
Of course, just as any other excel formula problem, we can solve this with … strong coffee.

Well, I am kidding, but coffee along with array formulas seems to help.

How to write an excel array formula to round and sort a list?

Assuming the data is in range C3:C12, and B3:B12 has running numbers from 1 to 10, the below array formula,

=SMALL(ROUNDDOWN(C3:C12,0),B3:B12)

when entered in the range D3:D12 will round and sort the range of values in C3:C12.

Remember, first you should select the entire range D3:D12 and then type the formula (in first cell) and press ctrl + shift + enter to make it an array formula.

Update: Even better alternatives from commenters

Here are few interesting alternatives, thanks to our commeneters.

  • =SMALL(ROUNDDOWN($B$1:$B$9,0),ROW(B1)), array enter in cell C1 and drag in the entire range. Thanks to Chrisham.
  • Instead of using ROW() as Chrisham did above, we can also use ROWS() function. This will let you add rows on top without having to change formulas. Elias recommends using this formula: =SMALL(INDEX(INT($C$3:$C$12),0),ROWS($D$3:D3)). Thank you.
  • Since we are only sorting numbers, it shouldn’t matter whether we sort and round or round and sort, as Jeff pointed. So, we can use the normal formula =ROUNDDOWN(SMALL($B$3:$B$12,ROWS(B$3:B3)),0) in cell C3 and copy in the entire range. Thanks Jeff

More resources: Learn excel array formulas | Online Help on Excel Formulas

Facebook
Twitter
LinkedIn

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week.

Learn & be awesome.

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME.

Read my storyFREE Excel tips book

Overall I learned a lot and I thought you did a great job of explaining how to do things. This will definitely elevate my reporting in the future.
Rebekah S
Reporting Analyst
Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

6 Responses to “Using Lookup Formulas with Excel Tables [Video]”

  1. Damian says:

    H1 !
    this is my very first comment.
    Can you use same technique with Excel 2003 lists ?
    thanks 😀

  2. Tom says:

    Thanks, Chandoo! I like seeing the sneak peak of what's to come on Friday too 🙂

  3. Chandoo says:

    @Damian.. Welcome to chandoo.org. Thanks for the comments.

    Yes, you can use the same with Excel 2003 lists too.

    @Tom.. You have seen future and its awesome.. isnt it?

  4. Q.fg says:

    Hi, is there a vlookup formula for the second example (IDlist)? I used a similar formula to look up the ID for the person, but the reverse way (look up the person with the ID) comes up N/A.

Leave a Reply