Select the product you need help with
XL2000: How to Return the Address of the Cell with the Largest or Smallest ValueArticle ID: 213375 - View products that this article applies to. This article was previously published under Q213375 On This PageSUMMARY
This article demonstrates two ways that you can find the address of the cell containing the largest or smallest value in a range of cells in a Microsoft Excel worksheet. If you are using a single row or column of data, you can use a worksheet formula. If you are using multiple rows or columns of adjacent data, you need to create a custom Microsoft Visual Basic for Applications function. For examples of both methods, see the "More Information" section.
MORE INFORMATIONUsing FormulasYou can return the address of the cell with the largest or smallest value in a column or row by using the CELL(), OFFSET(), and MATCH() functions along with the MAX() or the MIN() function.If there are multiple occurrences of the largest or smallest value, the following formulas return the cell address of the first occurrence of the value. If there is only one occurrence of the value, the address of the cell containing that value is returned. To return the address of a cell in a column (in this example, column A, cells A1:A10), use the appropriate formula in the following table.
For this
address Use this formula
------------------------------------------------------------------------
Cell with
largest
value =CELL("address",OFFSET(A1,MATCH(MAX(A1:A10),A1:A10,0)-1,0))
Cell with
smallest
value =CELL("address",OFFSET(A1,MATCH(MIN(A1:A10),A1:A10,0)-1,0))
For this
address Use this formula
----------------------------------------------------------------------
Cell with
largest
value =CELL("address",OFFSET(A1,0,MATCH(MAX(A1:J1),A1:J1,0)-1))
Cell with
smallest
value =CELL("address",OFFSET(A1,0,MATCH(MIN(A1:J1),A1:J1,0)-1))
Using Custom FunctionsMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104
(https://partner.microsoft.com/global/30000104)
Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice
(http://support.microsoft.com/gp/advisoryservice)
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
(http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)
To return the cell address of the largest value in an adjacent range that is larger than a single column or row, use the following custom Visual Basic for Applications function: REFERENCESFor additional information about getting help with Visual Basic forApplications, click the article number below
to view the article in the Microsoft Knowledge Base:
226118
(http://support.microsoft.com/kb/226118/EN-US/
)
OFF2000: Programming Resources for Visual Basic for Applications
PropertiesArticle ID: 213375 - Last Review: November 23, 2006 - Revision: 3.5
|


Back to the top








