Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
ereurts
 
Posts: n/a
Default re-arrange data in date order

Hi,

My name is Erik, I am trying to duplicate data in a worsheet in date order.
I know about the sort function and that's not what I am after. I need the
data to be duplicated in a new row and sorted by date. Can this be done? I
have been thinking about a nested "if" statement but the data row is lenghtly
and this will be very labour intencive..
Any suggestions???
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default re-arrange data in date order

One play to try ..

Sample construct available at:
http://www.savefile.com/files/6345502
AutoSort_DateOrder_ereurts_wks.xls

In Sheet1, source data is in cols A to C,
data from row2 down with dates in col A, eg:

Date Field1 Field2
18-Dec-05 Data1 Data1
06-Dec-05 Data2 Data2
18-Dec-05 Data3 Data3
06-Dec-05 Data4 Data4
07-Dec-05 Data5 Data5
etc

(Possibility of duplicate dates in col A is assumed)

In a new sheet: Ascending,
With the same col headers pasted in A1:C1

Put in E2:
=IF(Sheet1!A2="","",Sheet1!A2+ROW()/10^10)
Copy down to say, E100, to cover the max expected extent of data in Sheet1.
(Leave E1 empty)

Put in A2:
=IF(ISERROR(SMALL($E:$E,ROW(A1))),"",
INDEX(Sheet1!A:A,MATCH(SMALL($E:$E,ROW(A1)),$E:$E, 0)))
Copy A2 across to C2, fill down to C100
(cover the same extent as in col E)

Format col A as dates. Sheet2 will return an ascending sort of Sheet1 by the
dates in col A. Lines with duplicate dates, if any, will appear in the same
relative order as in Sheet1
--------

And if we want it auto-sorted in *descending* order instead
just slightly amend the formulas in E2 and A2 ...

In a new sheet: Descending
With the same col headers pasted in A1:C1

Put in E2:
=IF(Sheet1!A2="","",Sheet1!A2-ROW()/10^10)

( the change is from "+" to "-" for the part: "ROW()/10^10" )

Copy down to say, E100, to cover the max expected extent of data in Sheet1.
(Leave E1 empty)

Put in A2:
=IF(ISERROR(LARGE($E:$E,ROW(A1))),"",
INDEX(Sheet1!A:A,MATCH(LARGE($E:$E,ROW(A1)),$E:$E, 0)))

( the change is to replace SMALL with LARGE )

Copy A2 across to C2, fill down to C100
(cover the same extent as in col E)

Format col A as dates. Sheet2 will return a descending sort of Sheet1 by the
dates in col A. Lines with duplicate dates, if any, will appear in the same
relative order as in Sheet1.
--
Rgds
Max
xl 97
---
Singapore, GMT+8
xdemechanik
http://savefile.com/projects/236895
--
"ereurts" wrote in message
...
Hi,

My name is Erik, I am trying to duplicate data in a worsheet in date

order.
I know about the sort function and that's not what I am after. I need the
data to be duplicated in a new row and sorted by date. Can this be done? I
have been thinking about a nested "if" statement but the data row is

lenghtly
and this will be very labour intencive..
Any suggestions???



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
Printing data validation scenarios SJC Excel Worksheet Functions 14 July 24th 05 12:43 AM
Data Order Reversal chris_manning Excel Discussion (Misc queries) 3 July 12th 05 03:15 AM
data from one sheet to several in sequential order! firecord New Users to Excel 6 June 22nd 05 05:10 PM
unwanted number to date conversion while pasting data from web Jacek Excel Worksheet Functions 1 February 24th 05 02:59 PM


All times are GMT +1. The time now is 09:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"