Hello All,
I need a formula that can fetch the 2nd occurrence in the row.
Below is the example data:
Name Dept
xyz 10
xhu 12
xyz 15
Now i need a formula to fetch the 2nd match(here for xyz - Answer should be 15)
xyz 15
Thanks in advance!
Whichever actually suits...
1)
[TABLE="width: 192"]
<COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><TBODY>[TR]
[TD="class: xl63, width: 64, bgcolor: transparent"]
Name[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent"]
Dept[/TD]
[TD="class: xl63, width: 64, bgcolor: transparent"] [/TD]
[TD="class: xl63, width: 64, bgcolor: transparent"]
xyz[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]
xyz[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]
10[/TD]
[TD="class: xl63, bgcolor: transparent"] [/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]
10[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]
xhu[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]
12[/TD]
[TD="class: xl63, bgcolor: transparent"] [/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]
15[/TD]
[/TR]
[TR]
[TD="class: xl63, bgcolor: transparent"]
xyz[/TD]
[TD="class: xl63, bgcolor: transparent, align: right"]
15[/TD]
[TD="class: xl63, bgcolor: transparent"] [/TD]
[TD="class: xl63, bgcolor: transparent"] [/TD]
[/TR]
</TBODY>[/TABLE]
D2, control+shift+enter, not just enter, anc copy down:
Rich (BB code):
=IFERROR(INDEX($B$2:$B$4,SMALL(IF($A$2:$A$4=D$1,
ROW($A$2:$A$4)-ROW($A$2)+1),ROWS(D$2:D2))),"")
2)
[TABLE="width: 192"]
<COLGROUP><COL style="WIDTH: 48pt" span=4 width=64><TBODY>[TR]
[TD="class: xl66, width: 64, bgcolor: transparent"]
Name[/TD]
[TD="class: xl66, width: 64, bgcolor: transparent"]
Dept[/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"] [/TD]
[TD="class: xl65, width: 64, bgcolor: transparent"]
xyz[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
xyz[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]
10[/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]
2[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
xhu[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]
12[/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl66, bgcolor: transparent"]
Result[/TD]
[/TR]
[TR]
[TD="class: xl65, bgcolor: transparent"]
xyz[/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]
15[/TD]
[TD="class: xl65, bgcolor: transparent"] [/TD]
[TD="class: xl65, bgcolor: transparent, align: right"]
15[/TD]
[/TR]
</TBODY>[/TABLE]
D1: xyz
D2: 2 (meaning second occurrence)
D4, control+shift+enter, not just enter:
Rich (BB code):
=IF(COUNTIF($A$2:$A$4,D$1)>=2,INDEX($B$2:$B$4,
SMALL(IF($A$2:$A$4=D$1,ROW($A$2:$A$4)-ROW($A$2)+1),D$2)),"")