macentrap
asked on
script to sort dates in excel
Hi Experts,
Please assist in getting the lowest startdate and highest stop date.
attached is data sample with current and desired result tab.
Please assist in getting the lowest startdate and highest stop date.
attached is data sample with current and desired result tab.
http://technet.microsoft.com/en-us/library/ee692895.aspx
no attachment ....
ASKER
apologies, I thought it was atatched.
Book1.xlsx
Book1.xlsx
This will give the lowest start date
=MIN(B2:B14)
and this will give the lowest stop date
=MAX(C2:C14)
=MIN(B2:B14)
and this will give the lowest stop date
=MAX(C2:C14)
ASKER
Hi ssaqibh,
Min and max should be based on Serial column.
Min and max should be based on Serial column.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Not for points
Usng array formulas on whole columns is a VERY bad idea. Just because it can be done does not meant it should be. Always ringfence the ranges when using array formulas. Dynamic ranges spring to mind.
Usng array formulas on whole columns is a VERY bad idea. Just because it can be done does not meant it should be. Always ringfence the ranges when using array formulas. Dynamic ranges spring to mind.
To return the serial number, you can use this non-array formula
smallest start date =INDEX(A:A,MATCH(MIN(B:B), B:B,0))
largest stop date =INDEX(A:A,MATCH(MAX(C:C), C:C,0))
If the smallest/largest date occurs more than once, only the first match will be returned.
cheers, teylyn
smallest start date =INDEX(A:A,MATCH(MIN(B:B),
largest stop date =INDEX(A:A,MATCH(MAX(C:C),
If the smallest/largest date occurs more than once, only the first match will be returned.
cheers, teylyn
ASKER
Hi teylyn,
using Index only get serial number not the dates
using Index only get serial number not the dates
You said above:
>> Min and max should be based on Serial column.
Now I don't understand what you want to achieve. Your workbook has three columns:
Serial | Warranty Start Date | Warranty Stop Date
What exactly do you want to do? If you want to return the dates instead of the serial numbers, then use
smallest start date =INDEX(B:B,MATCH(MIN(B:B), B:B,0))
largest stop date =INDEX(C:C,MATCH(MAX(C:C), C:C,0))
I still don't understand how "based on Serial column" comes in. Please clarify.
cheers, teylyn
>> Min and max should be based on Serial column.
Now I don't understand what you want to achieve. Your workbook has three columns:
Serial | Warranty Start Date | Warranty Stop Date
What exactly do you want to do? If you want to return the dates instead of the serial numbers, then use
smallest start date =INDEX(B:B,MATCH(MIN(B:B),
largest stop date =INDEX(C:C,MATCH(MAX(C:C),
I still don't understand how "based on Serial column" comes in. Please clarify.
cheers, teylyn
ASKER
sure, will try and update soon
macentrap, you did not respond to my second comment. Does it not do what you want?
Maybe macentrap is still waiting for the array formulas with whole column references to finish calculating .... The Index version is much faster.
Yes but I need to be sure that the results are what he is looking for instead of proposing the solution and then ending up with "this is not what I want"
Let's give it a few days. This is still the weekend in many parts of the world, and other work pressures may take precedence.
In the meantime, you may want to compare the performance of the array formula with the performance of the Index/Match combo (non-array) formula on a dataset of 500 k rows.
cheers, teylyn
In the meantime, you may want to compare the performance of the array formula with the performance of the Index/Match combo (non-array) formula on a dataset of 500 k rows.
cheers, teylyn
ASKER
Hi teylyn/ ssaqibh,
Apologies for late reply, got tied up with other work.
Yes ssaqibh, second one worked just fine.
teylyn, there are duplicate serial.
Like for warranty,
Serial ABC is supported from 1 Jan 2010 to 1 July 2010 on phone based support but for parts replacememt the warranty does not end till 31 Dec 2014.
Secnario is warranty will start from 1 Jan2010 which will be the minimum start date but will end on maximum stop date for every serial item.
so the formula will be it checks the serial and check for min start date and max stop date.
Please, Can this be achieved through Index?
do agree array is slow for 80000 lines
Thank You
Apologies for late reply, got tied up with other work.
Yes ssaqibh, second one worked just fine.
teylyn, there are duplicate serial.
Like for warranty,
Serial ABC is supported from 1 Jan 2010 to 1 July 2010 on phone based support but for parts replacememt the warranty does not end till 31 Dec 2014.
Secnario is warranty will start from 1 Jan2010 which will be the minimum start date but will end on maximum stop date for every serial item.
so the formula will be it checks the serial and check for min start date and max stop date.
Please, Can this be achieved through Index?
do agree array is slow for 80000 lines
Thank You
ASKER
thank you