LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 605
Default Retrieve the Nth element in a dataset

Previously I learned the following

=INDEX(rng,MATCH(SMALL(COUNTIF(rng,"<"&rng),N),COU NTIF(rng,"<"&rng),0)) array formula à ascending order



=INDEX(rng,MATCH(LARGE(COUNTIF(rng,"<"&rng),N),COU NTIF(rng,"<"&rng),0)) array formula à descending order



I use them to retrieve the Nth element in a data set of numbers or text.



They work fine if there are no duplicates.



Tonight I have discovered a formula created by David Hager which takes care of duplicates. But it is only good for numbers.



=SMALL(IF(MATCH(rng2,rng2,0)=ROW(rng2)-MIN(ROW(rng2))+1,rng2,""),N) array formula -- ascending order



=LARGE(IF(MATCH(rng2,rng2,0)=ROW(rng2)-MIN(ROW(rng2))+1,rng2,""),N) array formula -- descending order



Don't know if I have missed anything. Biff, I will put them away in my stash although I can't think of an example why one would need to retrieve the Nth element.



Comments welcome from all.


 
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
Error message-Dataset... RUSH2CROCHET Excel Discussion (Misc queries) 1 July 20th 06 06:26 PM
Population Chart with 1 dataset minguier Excel Discussion (Misc queries) 1 June 20th 06 01:01 PM
Population Chart with 1 dataset minguier Excel Discussion (Misc queries) 0 June 20th 06 08:41 AM
Counting a Filtered Dataset T De Villiers Excel Worksheet Functions 1 September 5th 05 04:28 PM
importing dataset beyond 256 columns Arturo Excel Discussion (Misc queries) 1 December 17th 04 03:55 PM


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