Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default Matching max in a subgroup with corresponding data pair

I'm trying to write a function which returns the quantity purchased
from the most recent order given a list of customers, order dates, and
quantities.

Input would look like this:
Customer # Order date Quantity
1 3/5/06 2
1 4/12/06 5
1 5/19/06 4
2 1/3/06 3
2 4/5/06 4
3 2/12/06 2
3 3/19/06 1
3 5/22/06 7

Results would look like:

Customer # Most Recent Order Quantity
1 5/19/06 4
2 4/5/06 4
3 5/22/06 7


I've been trying to use INDEX(MATCH) but have not been successful,
probably because its the Friday of a long weekend.

Thanks again for everyone's help - Happy 4th.

JC

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Toppers
 
Posts: n/a
Default Matching max in a subgroup with corresponding data pair

If orders aere sorted by Ascending customer number and DESCENDING date then:

To get date:

=INDEX($B$2:$B$9,MATCH(A11,$A$2:$A$9,0))

to get qty:

=INDEX($C$2:$C$9,MATCH(A11,$A$2:$A$9,0))

If BOTH are sorted ASCENDING then:

=INDEX($B$2:$B$9,MATCH(A11,$A$2:$A$9,0)+COUNTIF($A $2:$A$9,A11)-1)

and (enter as array formula with Ctrl+ShiFt+Enter)

=INDEX($C$2:$C$9,MATCH(1,($A$2:$A$9=A11)*($B$2:$B$ 9=B11),0))

Sample below:

Customer Date Quantity
1 05/03/2006 2
1 12/04/2006 5
1 10/05/2006 4
2 01/03/2006 3
2 04/05/2006 4
3 12/02/2006 2
3 19/03/2006 1
3 22/05/2006 7

1 10/05/2006 4 <==row 11
2 04/05/2006 4
3 22/05/2006 7

HTH


" wrote:

I'm trying to write a function which returns the quantity purchased
from the most recent order given a list of customers, order dates, and
quantities.

Input would look like this:
Customer # Order date Quantity
1 3/5/06 2
1 4/12/06 5
1 5/19/06 4
2 1/3/06 3
2 4/5/06 4
3 2/12/06 2
3 3/19/06 1
3 5/22/06 7

Results would look like:

Customer # Most Recent Order Quantity
1 5/19/06 4
2 4/5/06 4
3 5/22/06 7


I've been trying to use INDEX(MATCH) but have not been successful,
probably because its the Friday of a long weekend.

Thanks again for everyone's help - Happy 4th.

JC


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Herbert Seidenberg
 
Posts: n/a
Default Matching max in a subgroup with corresponding data pair

Arrange your data like this:
CustA DateA QtyA CustB DateB QtyB
1 3/5/06 2 1 5/19/06 4
1 4/12/06 5 2 4/5/06 4
1 5/19/06 4 3 5/22/06 7
2 1/3/06 3
2 4/5/06 4
3 2/12/06 2
3 3/19/06 1
3 5/22/06 7

Name the six columns with the headers suggested.
Use Insert Name Create Top Row
Create the CustB list with
Advanced Filter Unique records
Check Tools Options General R1C1 Ref Style
Create the DateB and QtyB list respectively with
=SUMPRODUCT(MAX((CustA=CustB R)*DateA))
=SUMPRODUCT((CustA=CustB R)*(DateA=DateB R)*QtyA)
Uncheck R1C1

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
matching data from column b tbax6 Excel Worksheet Functions 1 November 23rd 05 10:53 PM
Fuzzy matching data JaB Excel Discussion (Misc queries) 0 November 9th 05 04:21 PM
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Excel Worksheet Functions 7 September 3rd 05 03:47 PM
Only text values matching using index/match lookup - data type pro Stanton Excel Worksheet Functions 1 August 2nd 05 01:05 AM
Matching data in one column to another excel idiot Excel Worksheet Functions 1 January 14th 05 02:15 PM


All times are GMT +1. The time now is 02:46 AM.

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"