View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max
 
Posts: n/a
Default Returning value next to the nth occurrence of a particular number.

One way ..

A sample construct is available at:
http://cjoint.com/?cvdLnPptlQ
Returning value next to the nth occurrence of a particular
number_daikontim_wks.xls

Assuming numbers and dates are in A1:B6
Put in C1: =IF(A1="","",COUNTIF($A$1:A1,A1))
Copy down to C6
Col C provides the occurence count for the numbers in col A

Assuming F1:F2 will contain the inputs for the number / occurence, and F3 is
where we want the result (corresp. date) to be

Put in F3, and array-enter (press CTRL+SHIFT+ENTER):
=INDEX(B1:B6,MATCH(1,(A1:A6=F1)*(C1:C6=F2),0))
Format F3 as date

Adapt the ranges to suit ..
(note that we can't use entire col refs)

Perhaps better with some minimal error trapping built-in, we could put
instead in F3, and array-enter the formula (as before):
=IF(OR(F1="",F2=""),"",INDEX(B1:B6,MATCH(1,(A1:A6= F1)*(C1:C6=F2),0)))

--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"daikontim" wrote in message
...
Hi,
I have 2 columns. Column A has numbers, some of which are repeated
numerous times. Column B has dates. How do I look up the nth

occurrence
of a particular number in column A and return the corresponding date?

Any
help greatly appreciated.