#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default dates max & min

hi all, please help

A B
--------- ----------
date item
--------- ----------
02/14/04 azm
07/22/05 naf
11/21/05 naf
03/26/06 naf
04/18/07 naf
04/20/07 azm
05/19/07 azm
06/08/07 ktm
08/22/07 ktm

i like to find the number of days between max and min dates for a given item
in column B



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default dates max & min

This is an array formula that must be entered using ctrl+shift+enter vs just
enter. ans=1190
=MAX(IF(B6:B14="azm",A6:A14))-MIN(IF(B6:B14="azm",A6:A14))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"excelFan" wrote in message
...
hi all, please help

A B
--------- ----------
date item
--------- ----------
02/14/04 azm
07/22/05 naf
11/21/05 naf
03/26/06 naf
04/18/07 naf
04/20/07 azm
05/19/07 azm
06/08/07 ktm
08/22/07 ktm

i like to find the number of days between max and min dates for a given
item
in column B




  #3   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default dates max & min

Assume source data within A2:B10, dates in A2:A10, items in B2:B10
Assume unique items are listed in D2 down, viz: azm, naf, etc
In E2, array-entered (press CTRL+SHIFT+ENTER to confirm the formula):
=MAX(IF(B$2:B$10=$D2,A$2:A$10))-MIN(IF(B$2:B$10=D2,A$2:A$10))
Format E2 as general/number. Copy down.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"excelFan" wrote:
hi all, please help

A B
--------- ----------
date item
--------- ----------
02/14/04 azm
07/22/05 naf
11/21/05 naf
03/26/06 naf
04/18/07 naf
04/20/07 azm
05/19/07 azm
06/08/07 ktm
08/22/07 ktm

i like to find the number of days between max and min dates for a given item
in column B



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default dates max & min

Works fine Don,
in my case our subject (number of days) is just a part of a bigger formula,
how to overcome using an arry formula. Thanks

"Don Guillett" wrote:

This is an array formula that must be entered using ctrl+shift+enter vs just
enter. ans=1190
=MAX(IF(B6:B14="azm",A6:A14))-MIN(IF(B6:B14="azm",A6:A14))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"excelFan" wrote in message
...
hi all, please help

A B
--------- ----------
date item
--------- ----------
02/14/04 azm
07/22/05 naf
11/21/05 naf
03/26/06 naf
04/18/07 naf
04/20/07 azm
05/19/07 azm
06/08/07 ktm
08/22/07 ktm

i like to find the number of days between max and min dates for a given
item
in column B





  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default dates max & min

Works fine Don,
in my case our subject (number of days) is just a part of a bigger
formula, how to overcome using an arry formula.


Give this non-array formula a try...

=SUMPRODUCT(MAX((B2:B10=C2)*(A2:A10)))+SUMPRODUCT( MAX((B2:B10=C2)*(99999-A2:A10)))-99999

where I assumed the dates started in A2, the code items in B2 and the
specified code item you wanted to calculate the date difference for in C2.

Rick



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default dates max & min



"Rick Rothstein (MVP - VB)" wrote:

Works fine Don,
in my case our subject (number of days) is just a part of a bigger
formula, how to overcome using an arry formula.


Thanks Rick,
just perfect that's does it, many thanks again

Give this non-array formula a try...

=SUMPRODUCT(MAX((B2:B10=C2)*(A2:A10)))+SUMPRODUCT( MAX((B2:B10=C2)*(99999-A2:A10)))-99999

where I assumed the dates started in A2, the code items in B2 and the
specified code item you wanted to calculate the date difference for in C2.

Rick


  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,202
Default dates max & min

I do not get the 'min' part of your formula to produce the correct result.
Yes, for the data given and for item "azm" it works, but that appears to be
because of the particular layout of the data. Try changing "azm" to "naf" to
see the problem.

Rick


"Don Guillett" wrote in message
...
Try this. Kind of tricky in that the max and min are DIFFERENT.
=SUMPRODUCT(MAX((B6:B14="azm")*(A6:A14)))-SUMPRODUCT(MIN(B6:B14="azm",A6:A14))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"excelFan" wrote in message
...
Works fine Don,
in my case our subject (number of days) is just a part of a bigger
formula,
how to overcome using an arry formula. Thanks

"Don Guillett" wrote:

This is an array formula that must be entered using ctrl+shift+enter vs
just
enter. ans=1190
=MAX(IF(B6:B14="azm",A6:A14))-MIN(IF(B6:B14="azm",A6:A14))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"excelFan" wrote in message
...
hi all, please help

A B
--------- ----------
date item
--------- ----------
02/14/04 azm
07/22/05 naf
11/21/05 naf
03/26/06 naf
04/18/07 naf
04/20/07 azm
05/19/07 azm
06/08/07 ktm
08/22/07 ktm

i like to find the number of days between max and min dates for a
given
item
in column B







  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default dates max & min


Actually, I wondered why it would work. Sometimes I forget to FULLY test.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rick Rothstein (MVP - VB)" wrote in
message ...
I do not get the 'min' part of your formula to produce the correct result.
Yes, for the data given and for item "azm" it works, but that appears to be
because of the particular layout of the data. Try changing "azm" to "naf"
to see the problem.

Rick


"Don Guillett" wrote in message
...
Try this. Kind of tricky in that the max and min are DIFFERENT.
=SUMPRODUCT(MAX((B6:B14="azm")*(A6:A14)))-SUMPRODUCT(MIN(B6:B14="azm",A6:A14))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"excelFan" wrote in message
...
Works fine Don,
in my case our subject (number of days) is just a part of a bigger
formula,
how to overcome using an arry formula. Thanks

"Don Guillett" wrote:

This is an array formula that must be entered using ctrl+shift+enter vs
just
enter. ans=1190
=MAX(IF(B6:B14="azm",A6:A14))-MIN(IF(B6:B14="azm",A6:A14))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"excelFan" wrote in message
...
hi all, please help

A B
--------- ----------
date item
--------- ----------
02/14/04 azm
07/22/05 naf
11/21/05 naf
03/26/06 naf
04/18/07 naf
04/20/07 azm
05/19/07 azm
06/08/07 ktm
08/22/07 ktm

i like to find the number of days between max and min dates for a
given
item
in column B








  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default dates max & min

many thanks Don,
this formula does not yield an ok numbers for the given data , may be
because of the min part of it , so please fully test and revert.

"Don Guillett" wrote:

Try this. Kind of tricky in that the max and min are DIFFERENT.
=SUMPRODUCT(MAX((B6:B14="azm")*(A6:A14)))-SUMPRODUCT(MIN(B6:B14="azm",A6:A14))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"excelFan" wrote in message
...
Works fine Don,
in my case our subject (number of days) is just a part of a bigger
formula,
how to overcome using an arry formula. Thanks

"Don Guillett" wrote:

This is an array formula that must be entered using ctrl+shift+enter vs
just
enter. ans=1190
=MAX(IF(B6:B14="azm",A6:A14))-MIN(IF(B6:B14="azm",A6:A14))

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"excelFan" wrote in message
...
hi all, please help

A B
--------- ----------
date item
--------- ----------
02/14/04 azm
07/22/05 naf
11/21/05 naf
03/26/06 naf
04/18/07 naf
04/20/07 azm
05/19/07 azm
06/08/07 ktm
08/22/07 ktm

i like to find the number of days between max and min dates for a given
item
in column B









  #11   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default dates max & min

Just wondering aloud why array-entering your combined formula (ie after
combining the original array suggested into your other, presumably non-array
formula) didn't work for you.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


  #12   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default dates max & min

galdly yes, there is a non array formula solved my issue, please refer to
Rick Rothstien's suggested non array formula above, it's just great
excelFan

"Max" wrote:

Just wondering aloud why array-entering your combined formula (ie after
combining the original array suggested into your other, presumably non-array
formula) didn't work for you.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---



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
how do I sort a column of random dates into Consecutive dates Rob Gibson Excel Worksheet Functions 2 June 12th 07 05:10 AM
Identifying unique dates in a range of cells containing dates... cdavidson Excel Discussion (Misc queries) 4 October 13th 06 03:30 PM
Identifying unique dates within a range of cells containing dates cdavidson Excel Discussion (Misc queries) 0 October 12th 06 08:19 PM
Calculating number of days between two dates that fall between two other dates [email protected] Excel Discussion (Misc queries) 5 October 26th 05 06:18 PM
Charting data against dates where dates are not at fixed intervals PK Charts and Charting in Excel 4 June 16th 05 05:08 AM


All times are GMT +1. The time now is 02:54 PM.

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

About Us

"It's about Microsoft Excel"