Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 37
Default Get list of row #s with certain value

I have a column in which rows will contain the value of "1" when that row
meets a certain criteria. I want to build an ascending list in another
location of the row numbers in that column that contain "1". Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Get list of row #s with certain value

Assume that col is col B, which would contain only 1's or blanks in B2 down

In C2:
=IF(B2=1,ROW(),"")
Leave C1 blank

In D2:
=IF(ROWS($1:1)COUNT(C:C),"",SMALL(C:C,ROWS($1:1)) )

Select C2:D2, copy down to cover the max expected extent in col B. Hide away
col C. Col D returns what you seek, all neatly bunched at the top. Adapt to
suit.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Mitch Powell" wrote:
I have a column in which rows will contain the value of "1" when that row
meets a certain criteria. I want to build an ascending list in another
location of the row numbers in that column that contain "1". Any ideas?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 37
Default Get list of row #s with certain value

Outstanding! Thank you very much.

"Max" wrote:

Assume that col is col B, which would contain only 1's or blanks in B2 down

In C2:
=IF(B2=1,ROW(),"")
Leave C1 blank

In D2:
=IF(ROWS($1:1)COUNT(C:C),"",SMALL(C:C,ROWS($1:1)) )

Select C2:D2, copy down to cover the max expected extent in col B. Hide away
col C. Col D returns what you seek, all neatly bunched at the top. Adapt to
suit.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Mitch Powell" wrote:
I have a column in which rows will contain the value of "1" when that row
meets a certain criteria. I want to build an ascending list in another
location of the row numbers in that column that contain "1". Any ideas?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Get list of row #s with certain value

welcome, Mitch.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Mitch Powell" wrote in message
...
Outstanding! Thank you very much.



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default Get list of row #s with certain value

Hello,

Another approach:
Enter into E2:
=MATCH(1,B2:$B$65536,)+1
Enter into E3:
=MATCH(1,INDEX(B:B,E2+1):$B$65536,)+E2
Copy down until you see error values...

Calculation times for 2000 rows with 115 "one"s: 0.65 millisecs
[Max': 48.77 millisecs where column D took 45.48ms]

Regards,
Bernd



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Get list of row #s with certain value

=SMALL(IF(data=1,ROW(INDIRECT("1:"&ROWS(data)))),R OWS($1:1))

ctrl+shift+enter, not just enter
copy down


"Mitch Powell" wrote:

I have a column in which rows will contain the value of "1" when that row
meets a certain criteria. I want to build an ascending list in another
location of the row numbers in that column that contain "1". Any ideas?

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default Get list of row #s with certain value

Hello Teethless Mama,

Your calculation time for 2000 rows with 115 "one"s: 100.03 millisecs
[FastExcel]

Regards,
Bernd

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Get list of row #s with certain value

Interesting timings there, Bernd ! Thanks.

Wonder how these comparative timings would look like if we were to say cover
20000 rows instead, and with error trapping* included for your/TM's
suggestions? *see below.

Copy down until you see error values...

Ahh, but my suggestion also eliminates all those nasty error values, giving
neat outputs for the OP <g
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Bernd P" wrote in message
oups.com...
Hello,

Another approach:
Enter into E2:
=MATCH(1,B2:$B$65536,)+1
Enter into E3:
=MATCH(1,INDEX(B:B,E2+1):$B$65536,)+E2
Copy down until you see error values...

Calculation times for 2000 rows with 115 "one"s: 0.65 millisecs
[Max': 48.77 millisecs where column D took 45.48ms]

Regards,
Bernd



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Get list of row #s with certain value

Wonder how these comparative timings would look like if we were to say
cover 20000 rows instead, and with error trapping* included for your/TM's
suggestions?


Try it. There's calc timer code he

http://msdn2.microsoft.com/en-us/library/aa730921.aspx

--
Biff
Microsoft Excel MVP


"Max" wrote in message
...
Interesting timings there, Bernd ! Thanks.

Wonder how these comparative timings would look like if we were to say
cover 20000 rows instead, and with error trapping* included for your/TM's
suggestions? *see below.

Copy down until you see error values...

Ahh, but my suggestion also eliminates all those nasty error values,
giving neat outputs for the OP <g
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Bernd P" wrote in message
oups.com...
Hello,

Another approach:
Enter into E2:
=MATCH(1,B2:$B$65536,)+1
Enter into E3:
=MATCH(1,INDEX(B:B,E2+1):$B$65536,)+E2
Copy down until you see error values...

Calculation times for 2000 rows with 115 "one"s: 0.65 millisecs
[Max': 48.77 millisecs where column D took 45.48ms]

Regards,
Bernd





  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default Get list of row #s with certain value

Hello Max,

For 20,000 rows with about 1,600 "one"s I got [FastExcel]:

You: about 6,000 msec
Teethless Mama without cleansing: 10,000 msec
Myself with cleansing: about 15 msec (almost no diff to the original
without cleansing)

Regards,
Bernd



  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Get list of row #s with certain value

Thanks for the link, Biff.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Get list of row #s with certain value

Bernd,
Thanks for the test and results !
You win hands down <g
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---


  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 806
Default Get list of row #s with certain value

Hi Biff,

Good reference, thanks.

And it is exactly that guy who offers FastExcel.

IMHO anyone who uses Excel seriously should have it and use it. Who
would drive a car without a speedometer?

Regards,
Bernd

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
Dropdown List - list item endings not visible if column too narrow AK9955 Excel Discussion (Misc queries) 2 April 27th 07 09:02 AM
validation list--list depends on the selection of first list Michael New Users to Excel 2 April 27th 06 10:23 PM
list 1 has 400 names List 2 has 4000. find manes from list 1 on 2 Ed Excel Worksheet Functions 5 September 12th 05 09:48 AM
find names on list 1 in list 2. list 1 4000 names list 2 400 name Ed Excel Worksheet Functions 1 September 4th 05 12:48 AM
sort list of players by team from player list on separate sheet Robert Excel Worksheet Functions 1 July 19th 05 01:57 AM


All times are GMT +1. The time now is 12:49 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"