Aged Date Range Formula

I am creating an aged ticket report for my manager.  I first calculated the Days open by using the formula =NOW()-A2, where cell A2 is the created date in yyyy/mm/dd format, which is rounded up to the nearest number.  I then want to calculate the date range each ticket is open,  0-3 days open, 4-7 days open, 8-15 days open, 16-30 days open, 31-60 days open, 61-120 days open and >120.  Both of these formulas are in cells q and R. Here is the formula:


When I run the formula it works great, but when I go to sort on the column I would like the data to sort from the lowest to the highest date range, but when I sort the ranges are all mixed up.  I mean they are grouped by the range but, for example the date range 61-120 comes first and then the date range 31-60 comes next.

How can I sort these so they are arranged either from the highest to the lowest or vice versa?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


you could use a helper's  column



you could also replace your formula with ifs with



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob HensonFinance AnalystCommented:
The values on which you are sorting are text so it is effectively sorting in alphabetical order rather than numerical.

When doing the sort you need to tell the sort to treat items that look like numbers as numbers. However this will still just sort by the first digit and then the next digit and so on.

The way round would be to sort on the Days Open column, this would then force the rows into their groups and be in the correct order.

Rob H
Rob HensonFinance AnalystCommented:
Another option for the Range formula would be to use a lookup table.

Table with:
0      0-3
4      4-7
8      8-15
16      16-30
31      31-60
61      61-120
999999      120


Where W2:X8 is table above.

This does throw out some differences due to the way you have calculated your number of days. Although formatted to zero decimal places, the days have part days in the value.

Using NOW() includes the time part of the current day. Do you want that or do you want whole days?

This will use only the date parts of each date stamp.

Rob H
Rrave26Author Commented:
Thanks this worked.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.