Sorry Shail, I didn't read it properly.
I think the problem is that you are using the MAX row number in the INDEX
function, bu you are getting the absolute row number within a function that
starts at roiw 2. If you started at row, no problem, otherwise you need to
allow for the start row
=IF(C3="","",IF(COUNTIF(C$2:C3,C3)>1,"000"&INDEX(C$2

3,MAX(ROW($2:2)*(C$2

2=C3))-ROW($C$2)+1,2)+1,IF(COUNTIF(C$2:C3,C3)=1,"0001","")))
I also would not test multi-column
=IF(C3="","",IF(COUNTIF(C$2:C3,C3)>1,"000"&INDEX(D$2

3,MAX(ROW($2:2)*(C$2:C
2=C3))-ROW($C$2)+1)+1,IF(COUNTIF(C$2:C3,C3)=1,"0001","")))
HTH is 'Hope that helps (helped)' :-)
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"shail" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi again Bob,
>
> Yes, I did it (array-entered, CTRL+SHIFT+ENTER), but it gave the
> circular reference as soon as I entered the same surname just below as
> above. Otherwise the formulae was working fine.
>
> Thanks,
>
> Shail
>
> what does "HTH" mean? Is it "Heart to Heart" or "Hand to Hand" or
> something else :-D
>
>
>
> Bob Phillips wrote:
> > It's far too complex for the job, but to answer the question, it needs
to be
> > array-entered and then it works.
> >
> > --
> > HTH
> >
> > Bob Phillips
> >
> >
>