PC Review


Reply
Thread Tools Rate Thread

Array function

 
 
S
Guest
Posts: n/a
 
      10th Dec 2007
Hi,
If I have an array of number, for instance grades(25,10,30,22), is there a
function that I could use to tell me which position of the array list
contains the smallest value? ie. in this case, it will return 1 as 10 is the
smallest value and its position in the array "grades" is 1.

Thanks.
 
Reply With Quote
 
 
 
 
Bernard Liengme
Guest
Posts: n/a
 
      10th Dec 2007
With your numbers entered in A1:A4, the formula =MATCH(MIN(A1:A4),A1:A4,0)
returns 2 as the min value (10) is in the second (not first) position

Likewise, =MATCH(LARGE(A1:A4,3),A1:A4,0) returns 4 since the third largest
value (here 22) is in position 4.

best wsihes
--
Bernard V Liengme
Microsoft Excel MVP
www.stfx.ca/people/bliengme
remove caps from email


 
Reply With Quote
 
Alan Beban
Guest
Posts: n/a
 
      10th Dec 2007
S wrote:
> Hi,
> If I have an array of number, for instance grades(25,10,30,22), is there a
> function that I could use to tell me which position of the array list
> contains the smallest value? ie. in this case, it will return 1 as 10 is the
> smallest value and its position in the array "grades" is 1.
>
> Thanks.

Since this is in the programming group, and because you referred to 10
as being in the 1 position in the array, I'll assume that grades is a
0-based array.


positionNumber=Application.Match(Application.Min(grades), grades, 0) - 1

Alan Beban
 
Reply With Quote
 
S
Guest
Posts: n/a
 
      11th Dec 2007
Thanks a lot. This is exactly what I am looking for.

"Alan Beban" wrote:

> S wrote:
> > Hi,
> > If I have an array of number, for instance grades(25,10,30,22), is there a
> > function that I could use to tell me which position of the array list
> > contains the smallest value? ie. in this case, it will return 1 as 10 is the
> > smallest value and its position in the array "grades" is 1.
> >
> > Thanks.

> Since this is in the programming group, and because you referred to 10
> as being in the 1 position in the array, I'll assume that grades is a
> 0-based array.
>
>
> positionNumber=Application.Match(Application.Min(grades), grades, 0) - 1
>
> Alan Beban
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OR function in array-entered IF function veggies27 Microsoft Excel Worksheet Functions 8 11th Mar 2008 06:32 PM
Pass from C# (framework 1.1) array of delegates to unmanaged DLL as array of function pointers verpeter@gmail.com Microsoft C# .NET 0 23rd Aug 2006 02:20 PM
Excel Function VLOOKUP - ARRAY Function Error elstuart Microsoft Excel Misc 2 21st Jul 2004 05:59 AM
Array Formula - Use of OFFSET function with array argument Alan Microsoft Excel Worksheet Functions 2 11th Feb 2004 09:38 PM
passing a params-array to another function with params-array Tobias Olbort Microsoft C# .NET 2 14th Jan 2004 04:57 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:35 PM.