Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default How do I return location (not value)of an Excel array's max value

How do I return the cell location (in addition to the value contained in the
cell) of the maximum value in an Excel array?

I'm trying to locate the row number for the maximum value in a column of
numbers.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default How do I return location (not value)of an Excel array's max value

Here is a function that returns a cell (range object) of the highes value in
a speicfied range.

Public Function MaxValue(ByVal rngToSearch As Range) As Range
Set MaxValue = rngToSearch.Find(Application.Max(rngToSearch))
End Function

Sub test()
Dim rng As Range

Set rng = MaxValue(ActiveSheet.Range("B:B"))
MsgBox rng.Value & vbTab & rng.Address
End Sub
--
HTH...

Jim Thomlinson


"Doug" wrote:

How do I return the cell location (in addition to the value contained in the
cell) of the maximum value in an Excel array?

I'm trying to locate the row number for the maximum value in a column of
numbers.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How do I return location (not value)of an Excel array's max value

Doug wrote:
How do I return the cell location (in addition to the value contained in the
cell) of the maximum value in an Excel array?

I'm trying to locate the row number for the maximum value in a column of
numbers.


The following will return the location of the max within the column. If it
returns "1" it's the first element of the array, and so forth.

[ ] = MATCH(MAX(A1:A10),A1:A10)

Bill
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
How do I return the location (as a range) of ActiveCell? Caeres Excel Discussion (Misc queries) 4 October 6th 08 09:44 PM
How do I return the cell location aneuro Excel Discussion (Misc queries) 4 May 27th 07 01:09 PM
Return the Row of a Variable's location xjetjockey Excel Discussion (Misc queries) 1 December 22nd 06 11:52 PM
Help with array's dgo Excel Worksheet Functions 2 June 28th 06 03:15 PM
Selecting & Displaying An Array's Contents Scott Excel Programming 0 February 20th 04 04:21 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"