find rows after counting data

jts2004

Board Regular
Joined
Apr 21, 2004
Messages
156
In a range A1:A100 the number 3 shows up 10 times. I have a formula to count all the 3's in the range now I want to know what rows they are on.
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
In cell B!: =if(a1=3,row(a1),"")
Copy down to cell b100

In cell C1: =if(iserror(small($B$1:$B$100,row(1:1)),"",small($B$1:$B$100,row(1:1))
Copy down to cell c100.
 

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
OR:

In cell B1: =MATCH(3,A1:A100,FALSE)
and in cell B2: =IF(ISERROR(MATCH(3,INDIRECT("A"&B1+1&":a100"),FALSE)),"",MATCH(3,INDIRECT("A"&B1+1&":a100"),FALSE)+B1)

copy B2 to B100.

This only works if your data actually starts at A1... if it starts on a lower row, you need a more general case.
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
jts2004 said:
In a range A1:A100 the number 3 shows up 10 times. I have a formula to count all the 3's in the range now I want to know what rows they are on.
Book1
ABCD
143
252
365
477
53 
68
73
87
99
Sheet1


C1 is used to specify the entry of interest.

C2:

=COUNTIF(A1:A9,C1)

Determines C1's frequency of occurrence in the target range.

C3:

=IF(ROW()-ROW(C$3)+1<=$C$2,SMALL(IF($A$1:$A$9=$C$1,ROW($A$1:$A$9)),ROW()-ROW(C$3)+1),"")

which is confirmed with control+shift+enter then copied down, determines the native row location per occurrence.
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454

ADVERTISEMENT

Hi jts2004:

How about ...
Book1
ABCD
1a33
2b6
338
41
52
63
77
83
9g
10
Sheet1


array formula in cell B1:B3 is ...

=SMALL(IF(A1:A10=3,ROW(A1:A10)),ROW(INDIRECT("1:"&C1)))
 

Watch MrExcel Video

Forum statistics

Threads
1,118,086
Messages
5,570,136
Members
412,305
Latest member
Mozz
Top