Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 229
Default Find nth occurance of data

How to find out the nth occurance of the data in a table?
A B C
1 a 10
2 b 5
3 a 15
4 c 20
5 b 30
6 a 40
There are three'a' s in the table. I want to list out the value in the
C-column for the third occurance of 'a' = 40.
with regards
sreedhar
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Find nth occurance of data

Try one of these:

This is an array formula** :

=INDEX(C1:C6,SMALL(IF(B1:B6="A",ROW(C1:C6)-MIN(ROW(C1:C6))+1),n))

Where n is the instance number you want.

The 3rd "A" in your list also happens to be the last "A" in the list. If you
want the *last* instance of "A":

Normally entered, not an array:

=LOOKUP(2,1/(B1:B6="A"),C1:C6)

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)


--
Biff
Microsoft Excel MVP


"yshridhar" wrote in message
...
How to find out the nth occurance of the data in a table?
A B C
1 a 10
2 b 5
3 a 15
4 c 20
5 b 30
6 a 40
There are three'a' s in the table. I want to list out the value in the
C-column for the third occurance of 'a' = 40.
with regards
sreedhar



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 229
Default Find nth occurance of data

Thank you Biff. The formula works like a charm
With regards
Sreedhar

"T. Valko" wrote:

Try one of these:

This is an array formula** :

=INDEX(C1:C6,SMALL(IF(B1:B6="A",ROW(C1:C6)-MIN(ROW(C1:C6))+1),n))

Where n is the instance number you want.

The 3rd "A" in your list also happens to be the last "A" in the list. If you
want the *last* instance of "A":

Normally entered, not an array:

=LOOKUP(2,1/(B1:B6="A"),C1:C6)

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)


--
Biff
Microsoft Excel MVP


"yshridhar" wrote in message
...
How to find out the nth occurance of the data in a table?
A B C
1 a 10
2 b 5
3 a 15
4 c 20
5 b 30
6 a 40
There are three'a' s in the table. I want to list out the value in the
C-column for the third occurance of 'a' = 40.
with regards
sreedhar




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default Find nth occurance of data

See the formulas in the "Arbitrary Lookups" section of
http://www.cpearson.com/Excel/TablesAndLookups.aspx .


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"yshridhar" wrote in message
...
How to find out the nth occurance of the data in a table?
A B C
1 a 10
2 b 5
3 a 15
4 c 20
5 b 30
6 a 40
There are three'a' s in the table. I want to list out the value in the
C-column for the third occurance of 'a' = 40.
with regards
sreedhar


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Find nth occurance of data

You're welcome. Thanks for the feedback!

--
Biff
Microsoft Excel MVP


"yshridhar" wrote in message
...
Thank you Biff. The formula works like a charm
With regards
Sreedhar

"T. Valko" wrote:

Try one of these:

This is an array formula** :

=INDEX(C1:C6,SMALL(IF(B1:B6="A",ROW(C1:C6)-MIN(ROW(C1:C6))+1),n))

Where n is the instance number you want.

The 3rd "A" in your list also happens to be the last "A" in the list. If
you
want the *last* instance of "A":

Normally entered, not an array:

=LOOKUP(2,1/(B1:B6="A"),C1:C6)

** array formulas need to be entered using the key combination of
CTRL,SHIFT,ENTER (not just ENTER)


--
Biff
Microsoft Excel MVP


"yshridhar" wrote in message
...
How to find out the nth occurance of the data in a table?
A B C
1 a 10
2 b 5
3 a 15
4 c 20
5 b 30
6 a 40
There are three'a' s in the table. I want to list out the value in the
C-column for the third occurance of 'a' = 40.
with regards
sreedhar






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
help to find a string for 4th occurance Eddy Stan Excel Worksheet Functions 1 September 22nd 07 11:13 PM
Macro to find last occurance hnyb1 Excel Discussion (Misc queries) 2 June 8th 07 04:40 PM
Find the 1st occurance of a number in a cell lovemuch Excel Worksheet Functions 4 August 17th 06 01:02 AM
Find next occurance Jambruins Excel Discussion (Misc queries) 5 August 10th 06 04:48 PM
Find last occurance of text in range farutherford Excel Worksheet Functions 5 August 30th 05 02:00 AM


All times are GMT +1. The time now is 05:51 PM.

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"