View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
muddan madhu muddan madhu is offline
external usenet poster
 
Posts: 747
Default Find the next date for a product

try this

put this formula in sheet 1 - Cell C2

=IF(B2=MAX(--(IF((sheet2!$A$2:$A$13=sheet1!A2),(sheet2!$B$2:$B
$13)))),"",MAX(--(IF((sheet2!$A$2:$A$13=sheet1!A2),(sheet2!$B$2:$B
$13)))))

use Ctrl + Shift + Enter



On Nov 19, 11:20*am, Algeraist
wrote:
No it didn't work -
Hope I entered it correctly

I've pasted the format I tested it on the the function

=IF(COUNTIF(Sheet2!A1:A13,A1),IF(VLOOKUP(A1,Sheet2 !A:B,2,0)B1,VLOOKUP(A1,S*heet2!A:B,2,0),""),"")

Test data look like this

Sheet 1
* * * * A * * * B * * * C
1 * * * Item 1 *3/03/2007 * * *
2 * * * Item 2 *4/03/2007 * * *
3 * * * Item 3 *3/06/2007 * * * 4/03/2008
4 * * * Item 4 *4/03/2007 * * *
5 * * * Item 5 *5/03/2007 * * *
6 * * * Item 6 *6/03/2007 * * *
7 * * * Item 7 *7/03/2007 * * *

Sheet 2

* * * * A * * * B
1 * * * item 1 *1/03/2007
2 * * * item 1 *4/03/2007
3 * * * item 1 *5/03/2007
4 * * * item 2 *1/03/2007
5 * * * item 2 *3/03/2008
6 * * * item 2 *3/03/2007
7 * * * item 2 *1/03/2008
8 * * * item 3 *4/03/2008
9 * * * item 3 *1/03/2008
10 * * *item 3 *2/03/2008
11 * * *item 3 *1/07/2008
12 * * *item 3 *23/03/2008
13 * * *item 3 *1/03/2008



"T. Valko" wrote:
Try this:


=IF(COUNTIF(Sheet2!A$2:A$15,A2),IF(VLOOKUP(A2,Shee t2!A$2:B$15,2,0)B2,VLOOK*UP(A2,Sheet2!A$2:B$15,2, 0),""),"")


--
Biff
Microsoft Excel MVP


"Algeraist" wrote in message
...
Hello,
I have an excel document with two sheets, sheet1 contains a list of
product
codes in column A and a date next to each in column B. Sheet2 is almost
the
same but with different dates and some products aren't on the list.


For each product code - In column C on sheet one I want to find the same
product code from sheet2 and pick up the date next to it if it is greater
than the date in column B. If there is no match I was going to leave the
cell
blank.


I've tried index/match with if statements and lookups but with no success


Any ideas.... Thanks in advance- Hide quoted text -


- Show quoted text -