Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sort multiple columns of dates

Posted on 2013-12-24
3
Medium Priority
?
291 Views
Last Modified: 2013-12-24
Hi Experts,

I have a worksheet named "Sorted_Data" which has columns as follows:

Name (A) , Date1 (B), Date2 (C), Date3 (D), Date4 (E), Date5 (F)

I would like to sort the sheet by columns B to F, sending the row with the closest date to today to the top of the list.

I would also like to format the dates with a color if the date is less than 28 days from today.

A header row exists.

Many thanks
Andy
0
Comment
Question by:Negativ3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 2000 total points
ID: 39738825
Andy,
I array-entered the following formula in cell G2 (copied down) to calculate the minimum number of days between the dates in B2:Fxxx and today:
=MIN(ABS(B2:F2-TODAY()))
To array-enter a formula:
1) Select the cell
2) Click in the formula bar
3) Hold the Control and Shift keys down
4) Hit Enter, then release all three keys
Excel should respond by adding curly braces { } surrounding the formula. If it does not (or if you see #VALUE! error value as the result), repeat steps 1 through 4.

I used the following formula criteria for Conditional Formatting to provide a yellow color if the date were 28 days or less from today:
=ABS(B2-TODAY())<=28

I used the following formula criteria for Conditional Formatting to put a border around the date that is closest to today:
=ABS(B2-TODAY())=$G2                 the $ before $G2 is important!

If you sort on column G in ascending order, you will get the desired results.
DatesClosesToTodayQ28325364.xlsm
0
 

Author Comment

by:Negativ3
ID: 39738845
byundt, that works nicely.

Now, say I want to create the sheet Sorted_Data from a master sheet at the press of a hot-key (ctrl-j). How would I enter the formulas into those cells using the VB editor?
0
 

Author Closing Comment

by:Negativ3
ID: 39738871
Managed to sort out the VB bit myself. Thanks for the help!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question